diff --git a/bin/deploy-on b/bin/deploy-on index 46d18e0..8e86207 100755 --- a/bin/deploy-on +++ b/bin/deploy-on @@ -29,12 +29,16 @@ die_usage () { ssh_or_die() { host="$1" cmd="$2" + allowed_return_codes="${3:-0}" $SSH "$host" "$cmd" ret="$?" - if [ "$ret" -ne "0" ]; then - info "An error occured while deploying on $host. Exiting." - exit "$ret" - fi + for allowed_ret in ${allowed_return_codes}; do + if [ "$ret" -eq "$allowed_ret" ]; then + return 0 + fi + done + info "An error occured while deploying on $host. Exiting." + exit "$ret" } # command line parsing @@ -65,7 +69,7 @@ deploy_on_host () { info "deploying on ${host}..." - ssh_or_die "$host" "sudo /usr/local/sbin/swh-puppet-apply" + ssh_or_die "$host" "sudo /usr/local/sbin/swh-puppet-apply" "0 2" info "deployment ok. Bye." }