From: Frank Brehm Date: Tue, 23 May 2023 14:06:32 +0000 (+0200) Subject: Trying to fix scripts/get-module-version. X-Git-Tag: 0.9.0~1^2~43 X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=7c0ae84354774391c4a0d3c7b13d1815903f240a;p=pixelpark%2Fpp-admin-tools.git Trying to fix scripts/get-module-version. --- diff --git a/scripts/get-module-version b/scripts/get-module-version index 7443c8e..c7eeeb0 100755 --- a/scripts/get-module-version +++ b/scripts/get-module-version @@ -17,7 +17,8 @@ fi declare -a MODULES=() PUPPET_ENV='*' -ENV_DIR="/etc/puppetlabs/code/environments" +DEFAULT_ENV_DIR="/etc/puppetlabs/code/environments" +ENV_DIR="${DEFAULT_ENV_DIR}" DESCRIPTION=$( cat <<-EOF Retrieving version number of given Puppet module(s) in all environments. @@ -42,7 +43,7 @@ usage() { If not given, '*' (all) environments are searched. -D|--dir PUPPET_ENV_DIR The directory, where the Puppet r10k environments are checked out - (Default: '${ENV_DIR}'). + (Default: '${DEFAULT_ENV_DIR}'). EOF echo @@ -84,19 +85,22 @@ get_options() { while [[ "$i" -lt "${len}" ]] ; do arg="${REMAINING_OPTS[$i]}" + debug "Evaluating option '${CYAN}${arg}${NORMAL}' ..." case "${arg}" in -E|--env|--environment) j=$(( $i + 1 )) PUPPET_ENV="${REMAINING_OPTS[$j]}" + debug "Puppet environment is now: '${CYAN}${PUPPET_ENV}${NORMAL}'." i=$(( $i + 2 )) ;; -D|--dir) j=$(( $i + 1 )) ENV_DIR="${REMAINING_OPTS[$j]}" + debug "Puppet environment directory is now: '${CYAN}${ENV_DIR}${NORMAL}'." i=$(( $i + 2 )) ;; - *) echo -e "Internal error - option '${RED}${arg}${NORMAL} was wrong!" + *) echo -e "Internal error - option '${RED}${arg}${NORMAL}' was wrong!" exit 1 ;; esac