salt icon indicating copy to clipboard operation
salt copied to clipboard

passing argument with '=no' to file.line

Open aabognah opened this issue 11 years ago • 5 comments

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.

aabognah avatar Nov 16 '15 17:11 aabognah

resolved with:

sudo salt '*' file.line /etc/default/useradd contect="CREATEMAIL_SPOOL=no" match="CREATE_MAIL_SPOOL=yes" mode="replace"

aabognah avatar Nov 16 '15 20:11 aabognah

@aabognah, thanks for the report. The problem is that the command line is run through the yaml renderer, which opportunistically interprets things.

jfindlay avatar Nov 17 '15 18:11 jfindlay

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.

whiteinge avatar Nov 17 '15 18:11 whiteinge

I've added the warning to the file.line function documentation with #30163.

rallytime avatar Jan 05 '16 22:01 rallytime

Thanks guys. awesome job.

aabognah avatar Feb 29 '16 22:02 aabognah