Hello, I have this stupid exec on a bash script but bear with me. Works OK on an ancient 0.xx Puppet setup. But not on 2.7.9. $command = "( /apps/path/scripts/install.sh || true ) && touch /etc/ puppet/puppet.script.done" exec { install: command => "$command", cwd => "/apps/path/scripts", path => "/bin:/usr/bin:/sbin:/usr/sbin", timeout => 600, logoutput => false, unless => ''test -f /etc/puppet.script.done'' } Whilst this command works OK on Solaris manually running under Puppet gives me:- /Exec[install]/returns: change from notrun to 0 failed: Could not find command ''('' Have tried all manner of escaping and single/double quote combos Any ideas on how to make this work ? Cheers -- 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.
Hi, the original problem is interesting. My guess is that Solaris puppet 2.7.x no longer runs execs through a shell that supports subshelling by paranthesis. Or somesuch. I don''t think you need it, though. On 01/05/2012 04:42 PM, OlliesDad@googlemail.com wrote:> $command = "( /apps/path/scripts/install.sh || true ) && touch /etc/ > puppet/puppet.script.done"If I catch your meaning, the subshell is opened so you ensure a zero exit code. If so - why? I propose $command = "/apps/path/scripts/install.sh ; touch /etc/puppet/puppet.script.done" That should do the equivalent. HTH, Felix -- 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.
On Thu, Jan 5, 2012 at 9:12 PM, OlliesDad@googlemail.com <Paul.Seymour@barcap.com> wrote:> Hello, > > I have this stupid exec on a bash script but bear with me. Works OK on > an ancient 0.xx Puppet setup. But not on 2.7.9. > > $command = "( /apps/path/scripts/install.sh || true ) && touch /etc/ > puppet/puppet.script.done"Why do you have to do a || with true here? afaik, /apps/path/scripts/install.sh && touch /etc/puppet/puppet.script.done should do.. or even better use a ; instead of &&> unless => ''test -f /etc/puppet.script.done''Just wondering if ^ this is /etc/puppet/puppet.script.done ? :) -- Srikrishna Das www.toonheart.com -- 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.
Hi, i think you can solve your Problem by adding provider => shell, http://docs.puppetlabs.com/references/stable/type.html#exec rgds Florian koch On Jan 5, 4:54 pm, krish <das.srikris...@gmail.com> wrote:> On Thu, Jan 5, 2012 at 9:12 PM, Ollies...@googlemail.com > > <Paul.Seym...@barcap.com> wrote: > > Hello, > > > I have this stupid exec on a bash script but bear with me. Works OK on > > an ancient 0.xx Puppet setup. But not on 2.7.9. > > > $command = "( /apps/path/scripts/install.sh || true ) && touch /etc/ > > puppet/puppet.script.done" > > Why do you have to do a || with true here? > afaik, /apps/path/scripts/install.sh && touch > /etc/puppet/puppet.script.done should do.. or even better use a ; > instead of && > > > unless => ''test -f /etc/puppet.script.done'' > > Just wondering if ^ this is /etc/puppet/puppet.script.done ? :) > > -- > Srikrishna Daswww.toonheart.com-- 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.
On Jan 5, 3:54 pm, krish <das.srikris...@gmail.com> wrote:> On Thu, Jan 5, 2012 at 9:12 PM, Ollies...@googlemail.com > > <Paul.Seym...@barcap.com> wrote: > > Hello, > > > I have this stupid exec on a bash script but bear with me. Works OK on > > an ancient 0.xx Puppet setup. But not on 2.7.9. > > > $command = "( /apps/path/scripts/install.sh || true ) && touch /etc/ > > puppet/puppet.script.done" > > Why do you have to do a || with true here? > afaik, /apps/path/scripts/install.sh && touch > /etc/puppet/puppet.script.done should do.. or even better use a ; > instead of && >Thanks that wouldn''t work if install.sh gave a non-zero RC. This is for testing environments (based on a case statement) outside of that is doesn''t call true and has no need for brackets. I agree it''s stupid and something of an inheritence. Thanks -- 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.
On 5 Jan 2012, at 16:54, krish <das.srikrishna@gmail.com> wrote:> > Why do you have to do a || with true here? > afaik, /apps/path/scripts/install.sh && touch > /etc/puppet/puppet.script.done should do.. or even better use a ; > instead of && >If install.sh fails then && will not allow touch to run, so I would have thought use of ; is actually required instead of &&. Touch will then always be executed regardless of the exit status of install.sh.> >> unless => ''test -f /etc/puppet.script.done'' > > Just wondering if ^ this is /etc/puppet/puppet.script.done ? :) > > > -- > Srikrishna Das > www.toonheart.com > > -- > 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. >-- 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.
On Jan 5, 2012, at 7:42 AM, OlliesDad@googlemail.com wrote:> $command = "( /apps/path/scripts/install.sh || true ) && touch /etc/ > puppet/puppet.script.done" > > exec { install: > command => "$command",Remember that putting something in double quotes is a request to have the value (re)evaluated for metacharacters. I doubt you want this. I would put the command itself in single quotes, and then just use> command => $command,...since what you want is for the shell, and not puppet, to be evaluating those metacharacters. -- Jo Rhett Net Consonance : consonant endings by net philanthropy, open source and other randomness -- 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.
Did you sort this one out? I also found out puppet on some solaris systems doesn''t like [ or ( as first character. A hack to get past it was to change the first character $command = "true && ( /apps/path/scripts/install.sh || true ) && touch /etc/ On Fri, Jan 6, 2012 at 7:52 AM, Jo Rhett <jrhett@netconsonance.com> wrote:> On Jan 5, 2012, at 7:42 AM, OlliesDad@googlemail.com wrote: > > $command = "( /apps/path/scripts/install.sh || true ) && touch /etc/ > puppet/puppet.script.done" > > exec { install: > command => "$command", > > > Remember that putting something in double quotes is a request to have the > value (re)evaluated for metacharacters. I doubt you want this. I would put > the command itself in single quotes, and then just use > > command => $command, > > > ...since what you want is for the shell, and not puppet, to be evaluating > those metacharacters. > > -- > Jo Rhett > Net Consonance : consonant endings by net philanthropy, open source and > other randomness > > -- > 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.-- 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.
In a recent version of Puppet - one that provides the `shell` and `exec` providers for exec - none of this should be necessary. If you give the `shell` provider, you will get your command run with the default shell, which should do the right thing. (Obviously, if the Solaris `/bin/sh` doesn''t like your code, it won''t work ;) Daniel On Wed, Jan 11, 2012 at 03:12, Andrew Hendry <andrew.hendry@gmail.com> wrote:> Did you sort this one out? I also found out puppet on some solaris > systems doesn''t like [ or ( as first character. > A hack to get past it was to change the first character > $command = "true && ( /apps/path/scripts/install.sh || true ) && touch /etc/ > > On Fri, Jan 6, 2012 at 7:52 AM, Jo Rhett <jrhett@netconsonance.com> wrote: >> On Jan 5, 2012, at 7:42 AM, OlliesDad@googlemail.com wrote: >> >> $command = "( /apps/path/scripts/install.sh || true ) && touch /etc/ >> puppet/puppet.script.done" >> >> exec { install: >> command => "$command", >> >> >> Remember that putting something in double quotes is a request to have the >> value (re)evaluated for metacharacters. I doubt you want this. I would put >> the command itself in single quotes, and then just use >> >> command => $command, >> >> >> ...since what you want is for the shell, and not puppet, to be evaluating >> those metacharacters. >> >> -- >> Jo Rhett >> Net Consonance : consonant endings by net philanthropy, open source and >> other randomness >> >> -- >> 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. > > -- > 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. >-- Daniel Pittman ⎋ Puppet Labs Developer – http://puppetlabs.com ♲ Made with 100 percent post-consumer electrons -- 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.