From: Frank Brehm Date: Thu, 12 Dec 2019 12:24:59 +0000 (+0100) Subject: Adding possibility to leave project empty X-Git-Tag: 1.3.12~1^2~1 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=d82c908eefe225623755db81f0c9e5f22793a274;p=pixelpark%2Fcreate-terraform.git Adding possibility to leave project empty --- diff --git a/postinstall-scripts/init-puppet b/postinstall-scripts/init-puppet index be26765..c3defee 100755 --- a/postinstall-scripts/init-puppet +++ b/postinstall-scripts/init-puppet @@ -21,7 +21,7 @@ NORMAL="" HAS_TTY='y' HAS_COLORS="n" -VERSION="0.9" +VERSION="1.0" BASENAME="$(basename ${0})" BASE_DIR="$(dirname ${0})" @@ -183,7 +183,7 @@ usage() { -p|--project CUSTOMER_PROJECT The customer related name of the project - the next level in the Hiera structure beyond the customer name. - If not given, the Hiera customer name will be used. + If not given, it will not be set. -O|--owner OWNER The owning Customer if this host. If not given, the Hiera customer will be used. @@ -350,10 +350,6 @@ get_options() { ENVIRONMENT=$( autodetect_env ) fi - if [[ -z "${PROJECT}" ]] ; then - PROJECT="${CUSTOMER}" - fi - if [[ -z "${OWNER}" ]] ; then OWNER="${CUSTOMER}" fi @@ -619,12 +615,20 @@ generate_facts() { local yfile="${facts_dir}/customer.yaml" info "Generating '${GREEN}${yfile}${NORMAL}' ..." - local content=$( cat <<-EOF - --- - customer: ${CUSTOMER} - project: ${PROJECT} - EOF - ) + if [[ -z "${PROJECT}" ]] ; then + local content=$( cat <<-EOF + --- + customer: ${CUSTOMER} + EOF + ) + else + local content=$( cat <<-EOF + --- + customer: ${CUSTOMER} + project: ${PROJECT} + EOF + ) + fi debug "Generatet content of '${yfile}':\n${content}" echo "${content}" > "${yfile}"