Ask Your Question

Why does exec fail when executing directly succeeds?

asked 2013-06-09 10:34:07 -0500

Pete Smith gravatar image

updated 2013-06-09 16:02:22 -0500

ramindk gravatar image

I'm new to writing my own manifests and this is my first question here, so any help is appreciated...

I'm trying to install php 5.4 on Ubuntu 12.04 and I'm struggling to install non-authenticated packages through apt. The closest I've got to a solution is to install php5 (5.3) then add a new repository and reinstall using an exec.

When I try this I get,

/Stage[main]/Php/Exec[reinstall php5.4]/returns: change from notrun to 0 failed: apt-get install php5 -y --force-yes returned 100 instead of one of [0] at...

The ... (more)

edit retag flag offensive close merge delete



If you add logoutput => on_failure, to your Exec does it log any additional information?

ramindk gravatar imageramindk ( 2013-06-09 13:22:35 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2013-06-10 05:38:17 -0500

Pete Smith gravatar image

updated 2013-06-10 05:41:50 -0500

Ok, thanks for the help. Adding logoutput => on_failure was what I needed - I didn't know about that parameter.

The issue was a sub program not being able to find programs that weren't on the single path I had provided. I changed it to path => ['/usr/bin', '/bin', '/sbin'] based on what couldn't be found and it worked perfectly.

Thanks to @ramindk and @andrey-adamovich for pointing me towards logoutput.

edit flag offensive delete link more



I recommend bookmarking the type reference. It's a good document to refer to when you're having problem with a particular type and want to look at any options ...(more)

ramindk gravatar imageramindk ( 2013-06-10 11:16:14 -0500 )edit

That's good advice, thanks. That link is dead though, I think you meant this:

Pete Smith gravatar imagePete Smith ( 2013-06-10 11:54:16 -0500 )edit

answered 2013-06-09 13:31:23 -0500

updated 2013-06-09 13:32:37 -0500

Most likely command that you launch returns output that looks "normal", but the exit code of the command is 100, which is not shown usually. Puppet's exec expects the code to be 0 for making it successful execution.

You can do several things. First, after you ran the command through direct SSH, try checking what the actual exit code was by typing this command right after apt-get install ...

 echo $?

Second, use suggestion from ramindk and add logoutput => on_failure to your exec resource.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-06-09 10:34:07 -0500

Seen: 6,503 times

Last updated: Jun 10 '13