function hydra_module_update {
# Command line arguments
MODULE="$1"
-
+
# Validation
if [ -z "$MODULE" ]; then
echo "Usage: hydra <hydra> module-update <module> [<module1> ... <moduleN>]"
echo "No such module $MODULE at $HYDRA puppet configuration."
exit 1
fi
-
+
# Update the module
(
cd $PUPPET/modules/$MODULE
git pull
)
-
+
# 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 )
}