-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
file.uncomment does not uncomment as expected #24907
Comments
@Akshaykapoor thanks for your report. Can you reproduce this on salt versions 2015.5.2? |
@arroyoc Will update the salt versions to that and get back with the results soon. |
I'm not sure if it's the same issue, but the error message makes me think it might be related. I used to successfully uncomment a bunch of lines in
I'm pretty sure it used to work (at least on a first run, see #25345). Now with 2015.5.3, it doesn't work anymore:
It successfully detects which lines to uncomment, but instead of uncommenting, it replaces the matching pattern with the whole regexp. If file.(un)comment are untrustworthy to the point that your usual answer is to advise using Seriously, this is an awful regression. It needs to be fixed ASAP. |
👍 When this functionality will be back? This regression is really nasty. |
I can confirm this in 2015.5.3. What other info is needed?
|
@Akshaykapoor We shouldn't need anymore information. This issue has been labeled appropriately and will be taken care of as soon as we can get to it. Thanks for your help. |
Seems to still be an issue in 2016.11.1 |
Here's an example of file.uncomment not working properly: /tmp/default.pa
/srv/salt/uncomment.sls
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue. |
This is def still an issue, stale bot. |
Thank you for updating this issue. It is no longer marked as stale. |
I question if it is the state file.uncomment function and not the renderer that is rendering the state file that is the root of the problem. I had a similar problem and found it to be that the yaml was rendering the escape characters in the regex strings. I had a look at the code and sure I think the code could be simplified a bit but logic looks good. In yaml state file the regex needs to be in single quote or have the escape escaped eg. \\ The code that dose the heavy lifting of updating the file has been update about year ago so I think MoonSweep's issue is now mute. For future reference nhavens example he has an wild card that will include the comment character and docs says don't include comment character. It is taking for example "#foox11-bellbar" to be uncommented due to wildcards and no matter what it will consider the line already uncommented. So my take on this issue, that it has been all issues have been fixed or explained but docs could be updated to make things a little clearer. |
I am going to close this out and request a new issue be filed verifying this on the latest release. Assuming this is a real issue it should be fixed. |
I want to uncomment a line from a config file,
In my salt state i'm writing the following,
This results in the a failure,
Looking at the debug log, i came across this,
which makes me think that i cannot use the different characters that i'm using '\W\d'. Not quite sure if this is a bug in salt but the my running it on CentOS 6.6 and salt version
How can i achieve the desired output using file.uncomment ?
The text was updated successfully, but these errors were encountered: