Hi everyone, I am trying to exec the following command: exec { ''Apply all kernel variables'' : path => ''/bin:/usr/bin:/usr/local/bin'', user => ''root'', logoutput => true, provider => shell, command => "for file in ${config_file} ${config_dir}/*.conf do [ -r \"\${file}\" ] && (echo Applying \"\${file}\" && /sbin/sysctl -q -p \"\${file}\") done", refreshonly => true, } Here is the output: err: /Stage[main]/Sysctl/Exec[Apply all kernel variables]: Failed to call refresh: for file in /etc/sysctl.conf /etc/sysctl.d/*.conf do [ -r "${file}" ] && (echo Applying "${file}" && /sbin/sysctl -q -p "${file}") done returned 1 instead of one of [0] at /etc/puppet/modules/sysctl/manifests/init.pp:93 Is simply doesn''t work, I know that there are some special behavior with the exec ressource. Of course the following exec works: exec { ''Apply all kernel variables'' : path => ''/bin:/usr/bin:/usr/local/bin'', user => ''root'', logoutput => true, provider => shell, command => ''for file in /etc/sysctl.conf /etc/sysctl.d/*.conf do [ -r "\${file}" ] && (echo Applying "\${file}" && /sbin/sysctl -q -p "\${file}") done'', refreshonly => true, } I have extremely big trouble using " instead of '', any idea? Regards, JM -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Elias Abacioglu
2012-Feb-29 21:58 UTC
Re: [Puppet Users] Exec provider shell with ''for'' loop
Antidot SAS skrev 2012-02-29 11:04:> > I have extremely big trouble using " instead of '', any idea? >You could try replacing double escaping \\ and see if that works. Perhaps it''s simpler if you have file { /tmp/script.sh : content => "for ...$variable" } or using a template and create a .erb file that is uploaded. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Antidot SAS
2012-Mar-01 00:12 UTC
Re: [Puppet Users] Exec provider shell with ''for'' loop
Thx I''ll think about it. Le 29 févr. 2012 22:58, "Elias Abacioglu" <elias.rabi@gmail.com> a écrit :> > > Antidot SAS skrev 2012-02-29 11:04: > >> >> I have extremely big trouble using " instead of '', any idea? >> >> You could try replacing double escaping \\ and see if that works. > > Perhaps it''s simpler if you have file { /tmp/script.sh : content => "for > ...$variable" } > or using a template and create a .erb file that is uploaded. > > -- > 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+unsubscribe@** > googlegroups.com <puppet-users%2Bunsubscribe@googlegroups.com>. > For more options, visit this group at http://groups.google.com/** > group/puppet-users?hl=en<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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.