On Sep 19, 2011, at 8:52 AM, Tim Coote 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?
----
Do you recognize that puppet executions are performed by user 'root'? 

Does this file have 777 permissions?

Is the first line of 'test' something like "#!/bin/bash" ? Probably a good idea 
to get in the practice of naming shell script files with a recognizable 
extension (i.e. test.sh)

I suppose that the reason the other commands success is simply because the 
redirection exists so the redirection occurs and the command is true, 
regardless of anything that occurs or fails in your shell script itself.

Craig

-- 
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