Hi, I can't help directly with your issue cause I'm not at a computer but wouldn't it be easier to use a file resource with a template in this case rather than mess around with the escaping in the execs?
Cheers, Den On 01/12/2011, at 6:33, Sans <[email protected]> wrote: > Hi there, > > I'm basically trying to change a line this: > > myenv_set "MY_SW_DIR_1" "/exp/dir/sw1" > to > myenv_set "MY_SW_DIR_1" "/exp/fs/sw1.ac.uk" > > in the one of the "/etc/profile.d/" file. So, I've defined it like > this: > > ----------------- > define env_check($file, $string, $swdir, $refreshonly = 'false') { > $q_cmd = "/usr/bin/printenv | grep -F $swdir | cut -d= -f2" > exec { "/bin/sed -e \"/$swdir/{s:$($q_cmd):$string:g}\" '$file'": > #unless => "/usr/bin/printenv | grep -F $swdir | cut -d= -f2 > | grep -vFxe '$string'", > unless => "eval $q_cmd | grep -vFq '$string'", > path => '/bin', > refreshonly => $refreshonly, > } > } > ------------------- > > and then use it like this: > > ------------------- > env_check { sw_dir1: > file => '/etc/profile.d/my-env.sh', > string => '/exp/fs/sw1.ac.uk', > swdir => 'MY_SW_DIR_1'; > } > } > ------------------- > > but it's not working. Can anyone please help? Cheers!! > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
