]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Trying to fix scripts/get-module-version.
authorFrank Brehm <frank@brehm-online.com>
Tue, 23 May 2023 14:06:32 +0000 (16:06 +0200)
committerFrank Brehm <frank@brehm-online.com>
Tue, 23 May 2023 14:06:32 +0000 (16:06 +0200)
scripts/get-module-version

index 7443c8e32ca890f5254efcc1921e2bc746c62df4..c7eeeb096dc62f132a9e0f3be01379d28f020d91 100755 (executable)
@@ -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