-
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.comment issue when multiple lines with some already commented #41818
Comments
Looks like we need the ability to search and comment all instances of a particular expression. Marking this as approved. Thanks for the report! |
I think someone really went overboard with the error checking in this module. |
I've just stumbled across this as well and agree that the checks done in Dito for Just get rid of that first "already commented?" regex search… |
Any update on this one? Seems to still be an issue. |
I got here searching for file.commet bugs. It would make sense to me that un-comment throws an error if no match found, but the comment should not, or it should be made clear in the documentation. Also, the regex seems to be anchored with an implicit "^" even if not supplied in the state regex. |
@diepes I'm not a Salt developer myself, so take what I'm saying with a grain of salt (no pun intended). The behavior if the pattern isn't found at all matches the |
Thanks for the PR! |
Description of Issue/Question
I try to comment some lines in a FreeBSD configuration file. This file contains some comment containing itself the pattern I want to find. Result is that nothing is done.
According to documentation "comment"/"uncomment" do not have a "flags" argument, would it be relevant to add it ?
Setup
Master(less) : Debian Stretch / virtualenv Python 2.7.13 (pip install salt-ssh) / salt-ssh 2016.11.5 (Carbon)
Minion (agentless) : FreeBSD 11.0 in virtualbox / Python 2.7.13
Steps to Reproduce Issue
First
On minion : create a file /home/test_user/test.conf :
On master : create a test.sls :
And add it to top.sls
Than
salt-ssh 'the_minion' state.apply
What I get
But if I replace "/bad/news" by "bAd/news" in line 4 of test.conf, I get :
The text was updated successfully, but these errors were encountered: