Skip to content

Commit 7b52cbe

Browse files
authored
Merge pull request #137 from puppetlabs/fix-puppet_runonce
Make puppet_runonce exit non-zero on resrc failure
2 parents 300e350 + d8fb0c2 commit 7b52cbe

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tasks/puppet_runonce.sh

+11
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,15 @@ echo
2424
--no-usecacheonfailure \
2525
--no-splay \
2626
--no-use_cached_catalog \
27+
--detailed-exitcodes \
2728
$NOOP_FLAG
29+
30+
# Without --detailed-exitcodes, the `puppet agent` command will return 0 even
31+
# if there are resource failures. Use --detailed-exitcodes but only exit
32+
# non-zero if an error occurred. Changes (code 2) are not errors.
33+
exitcode=$?
34+
if [ $exitcode -eq 0 -o $exitcode -eq 2 ]; then
35+
exit 0
36+
else
37+
exit $exitcode
38+
fi

0 commit comments

Comments
 (0)