#!/bin/bash # # Update a puppet module # # Load source $APP_BASE/lib/hydra/functions || exit 1 hydra_config_load # Command line arguments MODULE="$1" # Validation if [ -z "$MODULE" ]; then echo "Usage: hydra module-update " exit 1 elif [ ! -d "$PUPPET/modules/$MODULE" ]; then echo "No such module $MODULE at $HYDRA puppet configuration." exit 1 fi # Update the module ( cd $PUPPET/modules/$MODULE; git pull origin master ) # Verify the module if ! hydra $HYDRA module-verify $MODULE; then echo "ERROR: Updated module doesn't match hash, please verify and update manually." exit 1 fi # Commit ( cd $PUPPET; git commit -a -m "Updating module $MODULE"; git push )