From: Veselin Bochev Date: Wed, 8 Jun 2022 13:28:53 +0000 (+0300) Subject: fix error due to missing field in puppet X-Git-Tag: 1.6.1~1^2~3 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=6e96a5887b26dd68a1263efbfa19e36431d29854;p=pixelpark%2Fcreate-terraform.git fix error due to missing field in puppet --- diff --git a/bin/pre-terraform b/bin/pre-terraform index 5a27bce..6c532fd 100755 --- a/bin/pre-terraform +++ b/bin/pre-terraform @@ -127,7 +127,7 @@ sample_pre_tf = { "data_disks": [], "puppet": { "customer": "__", - "project": "__", + "project": "__ <<< Check this", "role": "default", "tier": "__", "environment": "__" @@ -217,7 +217,8 @@ try: sample_pre_tf["defaults"]["customer"] = data["pp_owner"]["value"].split(' ')[0] # Project - sample_pre_tf["defaults"]["puppet"]["project"] = data["project"]["value"] + if "projects" in data.keys(): + sample_pre_tf["defaults"]["puppet"]["project"] = data["project"]["value"] # Purpose sample_pre_tf["defaults"]["purpose"] = data["pp_purpose"]["value"].split(' ')[0] @@ -227,7 +228,7 @@ try: sample_pre_tf["defaults"]["puppet"]["environment"] = data["r10k_environment"]["value"] except Exception as e: print("ERROR: Failed parsing required fields from output. Please check if hostname is in PuppetDB") - # print(f"ERROR: {e}") + print(f"ERROR: {e}") _exit(1) # Print the YAML configuration file