passing argument with '=no' to file.line
I spent basically all morning on this and cant get it to work.
I am trying to modify one line in a file using the file.line module:
$ sudo salt '*' file.line /etc/default/useradd "CREATE_MAIL_SPOOL=no" match="CREATE_MAIL_SPOOL=yes" mode='replace'
But I am getting this error:
ERROR executing 'file.line': The following keyword arguments are not valid: CREATE_MAIL_SPOOL=False
Somehow salt translates any '=no' in the command argument into '=False' and complains about it. How to I stop it from doing that?
Thanks.
resolved with:
sudo salt '*' file.line /etc/default/useradd contect="CREATEMAIL_SPOOL=no" match="CREATE_MAIL_SPOOL=yes" mode="replace"
@aabognah, thanks for the report. The problem is that the command line is run through the yaml renderer, which opportunistically interprets things.
Many of the functions in the file execution and state modules have warnings about this behavior (see file.replace). We should get it added to file.line as well.
I've added the warning to the file.line function documentation with #30163.
Thanks guys. awesome job.