diff --git a/bin/deploy-on b/bin/deploy-on index 882e78d..4067a1a 100755 --- a/bin/deploy-on +++ b/bin/deploy-on @@ -1,70 +1,69 @@ #!/bin/bash -set -e # trigger a puppet deployment on a given SWH machine # see https://intranet.softwareheritage.org/index.php?title=Puppet_setup info () { echo "*** swh-deploy: $1" } prompt () { echo -n "*** swh-deploy: $1" } die_usage () { echo "Usage: bin/deploy-on [OPTION] HOST..." echo "E.g.: bin/deploy-on worker01 worker03" echo " bin/deploy-on --no-master worker02" exit 1 } DOMAIN="internal.softwareheritage.org" MASTER="pergamon.${DOMAIN}" SSH="ssh -t" # command line parsing deploy_on_master="yes" if [ "$1" = "-h" -o "$1" = "--help" ] ; then die_usage fi if [ "$1" = "--no-master" ] ; then deploy_on_master="no" shift fi if [ -z "$1" ] ; then die_usage fi if [ "$deploy_on_master" = "yes" ] ; then info "deploying recipes on ${MASTER}..." $SSH "$MASTER" "sudo /usr/local/sbin/swh-puppet-master-deploy" info "master ok." fi for host in "$@" ; do info "starting test run on ${host}..." $SSH "$host" "sudo /usr/local/sbin/swh-puppet-test" info "test run ok." while true ; do prompt "does the above diff for ${host} look good? [y/n] " read yn case $yn in [yY] ) break ;; [nN] ) info "deployment aborted, as requested." exit 2 ;; * ) continue ;; esac done info "deploying on ${host}..." $SSH "$host" "sudo /usr/local/sbin/swh-puppet-apply" info "deployment ok. Bye." done