r10k and git exit code(s)

asked 2017-05-02 04:42:36 -0500

craymore gravatar image

Hello all !

I couldn't help but notice that r10k simply does not provide an adequate return code when a git sub-command fails.

e.g :

$> puppetserver ruby /opt/puppetlabs/server/data/puppetserver/jruby-gems/bin/r10k deploy environment ENV_TEST --config /tmp/r10k-config-generated.yaml.02052017111657_4489 --puppetfile --verbose debug

[2017-05-02 11:30:03 - DEBUG] Fetching 'http://coderepo/r/puppet/controlrepos/my_cr.git' to determine current branches.
[2017-05-02 11:30:04 - ERROR] Unable to determine current branches for Git source 'my_cr' (/etc/puppetlabs/code/environments)
Original exception:
Command exited with non-zero exit code:
Command: git --git-dir /var/cache/r10k/http---coderepo-r-puppet-controlrepos-my_cr.git fetch origin --prune
Stderr:
error:  while accessing http://coderepo/r/puppet/controlrepos/my_cr.git/info/refs

fatal: HTTP request failed
Exit code: 128

$> echo $?
0

The example above shows what happens when the provided URL(s) cannot be reached : while the message is explicit enough, the return code provided by r10k does NOT indicate that there was a failure

I there a way to make sure that the return code provided by r10k is different from 0 when a git failure occurs ?

Thanks beforehand for any advice !

edit retag flag offensive close merge delete