David Portabella
2014-Mar-10 15:02 UTC
[Puppet Users] when a puppet exec resource contains several "single commands", puppet exec only fails if the last exec command fails
exec {'test': command => "/bin/ls /doesnotexit", } fails as expected: Error: /bin/ls /doesnotexit returned 1 instead of one of [0] Error: /Stage[main]//Exec[test]/returns: change from notrun to 0 failed: /bin/ls /doesnotexit returned 1 instead of one of [0] However, exec {'test': command => "/bin/ls /doesnotexit; /bin/echo hello", } does not fail, because the last command did not return an error! that's a problem, because there are many puppet modules which concatenate several commands in one puppet exec, and they do not explicitly handle the errors. (inserting "set -e" at the head of the command line does not work, as it is bash script specific) *I think that, by default, the puppet exec resource should fail if any of the "single commands" fail (as * *in the second example).and if it is not by default, at least there should be an option in puppet exec to do so (equivalent to "set -e" in bash)* (tested on puppet 3.3.2) -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/fc8a32ca-1e7b-4376-ace7-a1c36dd665c3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.