now the script will bail out if it has been provided with too much arguments

This commit is contained in:
aminnairi
2024-01-04 12:31:33 +01:00
parent 6389c8b30f
commit ff865f7484
+10 -3
View File
@@ -2,9 +2,10 @@
ERROR_BECAUSE_ROOT=1
ERROR_BECAUSE_NOT_ARCH_LINUX=2
ERROR_BECAUSE_ANSIBLE_INSTALLATION_FAILED=3
ERROR_BECAUSE_PLAYBOOK_INVALID_OR_NOT_FOUND=4
ERROR_BECAUSE_PLAYBOOK_PATH_DOES_NOT_EXIST=5
ERROR_BECAUSE_TOO_MUCH_ARGUMENTS_PROVDED=3
ERROR_BECAUSE_ANSIBLE_INSTALLATION_FAILED=5
ERROR_BECAUSE_PLAYBOOK_INVALID_OR_NOT_FOUND=5
ERROR_BECAUSE_PLAYBOOK_PATH_DOES_NOT_EXIST=6
if [[ "$(id -u)" -eq 0 ]]
then
@@ -29,6 +30,12 @@ then
fi
fi
if [[ $# -gt 1 ]]
then
echo "Too much arguments provided."
exit $ERROR_BECAUSE_TOO_MUCH_ARGUMENTS_PROVDED
fi
choosen_playbook_path=$1
if [[ -z $choosen_playbook_path ]]