From a5a1dd73edecbf0ba9f01df2c1890d2a956316a2 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Mon, 12 Oct 2020 13:53:21 +0200 Subject: [PATCH] Setting project for Sparkasse customers, if not given --- postinstall-scripts/init-puppet | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/postinstall-scripts/init-puppet b/postinstall-scripts/init-puppet index 63de5c8..72b1f9c 100755 --- a/postinstall-scripts/init-puppet +++ b/postinstall-scripts/init-puppet @@ -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}${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} -- 2.39.5