Here's an idea: the first one is probably not run by the shell, as there is no shell meta-characters in it. The latter three all have shell meta-characters in them.
I don't know for certain that puppet does it this way, but it is common to do things in this manner in scripting languages all over the place. Is this possible? If this is true, then using any shell meta-character (such as backquotes, wildcards, pipes, or other things) will cause your script to succeed. -- David Douthitt [email protected] On Monday, September 19, 2011 8:52 AM, "Tim Coote" <[email protected]> wrote: > I've clearly not approaching this correctly, so would appreciate some > advice. > > I have a trivial shell script to execute. I've whittled this down to a > one line invocation of true. The file is called test and has mode 755 > > I'm testing with: > sudo puppetd --debug --test > > I'm using puppet-0.25.5-2.fc15.noarch on the client and > puppet-0.25.5-1.fc14.noarch on the server. > > I have an exec component that looks like this: > > exec { "initMysql": > cwd => "/home/tim/backups", > path => ["/usr/bin", "/bin"], > command => "/home/tim/backups/test", # fails > # command => "/home/tim/backups/test 2>&1", # works > # command => "/home/tim/backups/test > /tmp/wibble", # works > # command => "/home/tim/backups/test 2> /tmp/wibble", # works > logoutput => true, > creates => "/home/tim/backups/inited", > } > > Failure looks like this: > > debug: //Node[uranustest]/Exec[initMysql]: Changing returns > debug: //Node[uranustest]/Exec[initMysql]: 1 change(s) > debug: //Node[uranustest]/Exec[initMysql]: Executing '/home/tim/ > backups/test' > debug: Executing '/home/tim/backups/test' > err: //Node[uranustest]/Exec[initMysql]/returns: change from notrun to > 0 failed: /home/tim/backups/test returned 1 instead of one of [0] at / > etc/puppet/manifests/nodes.pp:117 > > > An example of success looks like this: > > debug: //Node[uranustest]/Exec[initMysql]: Changing returns > debug: //Node[uranustest]/Exec[initMysql]: 1 change(s) > debug: //Node[uranustest]/Exec[initMysql]: Executing '/home/tim/ > backups/test 2>&1' > debug: Executing '/home/tim/backups/test 2>&1' > notice: //Node[uranustest]/Exec[initMysql]/returns: executed > successfully > > I'm pretty sure that I shouldn't need to redirect the output to get > the command to work. > > Any thoughts? > > Tim > > -- > 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.
