]> Frank Brehm's Git Trees - pixelpark/create-terraform.git/commitdiff
Setting project for Sparkasse customers, if not given
authorFrank Brehm <frank.brehm@pixelpark.com>
Mon, 12 Oct 2020 11:53:21 +0000 (13:53 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Mon, 12 Oct 2020 11:53:21 +0000 (13:53 +0200)
postinstall-scripts/init-puppet

index 63de5c89e8cdb16853832520136e30bb49860ae3..72b1f9ccd9a46d502c6dfae4afb9fd653fff3c12 100755 (executable)
@@ -21,7 +21,7 @@ NORMAL=""
 HAS_TTY='y'
 HAS_COLORS="n"
 
-VERSION="1.1"
+VERSION="1.2"
 
 BASENAME="$(basename ${0})"
 BASE_DIR="$(dirname ${0})"
@@ -358,6 +358,13 @@ get_options() {
         TIER="${ENVIRONMENT}"
     fi
 
+    if [[ -z "${PROJECT}" ]] ; then
+        if [[ "${CUSTOMER}" =~ ^spk- ]] ; then
+            warn "No project for customer '${YELLOW}${CUSTOMER}${NORMAL}' given, setting it to customer."
+            PROJECT="${CUSTOMER}"
+        fi
+    fi
+
     if [[ -z "${ROLE}" ]] ; then
         echo "Option '${RED}-R|--role${NORMAL}' may not be empty." >&2
         echo >&2
@@ -367,12 +374,17 @@ get_options() {
 
     debug "Using following options:"
     if [[ "${VERBOSE}" == "y" ]] ; then
+        local project_out="${CYAN}<undef>${NORMAL}"
+        if [[ -n "${PROJECT}" ]] ; then
+            project_out="${GREEN}${PROJECT}${NORMAL}"
+        fi
         local msg=$( cat <<-EOF
                FQDN:               ${GREEN}${FQDN}${NORMAL}
                Puppet environment: ${GREEN}${ENVIRONMENT}${NORMAL}
                Tier:               ${GREEN}${TIER}${NORMAL}
                Role:               ${GREEN}${ROLE}${NORMAL}
                Hiera customer:     ${GREEN}${CUSTOMER}${NORMAL}
+               Customer project:   ${project_out}
                Owner:              ${GREEN}${OWNER}${NORMAL}
                Contact address:    ${GREEN}${CONTACT}${NORMAL}
                Purpose:            ${GREEN}${PURPOSE}${NORMAL}