]> Frank Brehm's Git Trees - pixelpark/create-terraform.git/commitdiff
fix error due to missing field in puppet
authorVeselin Bochev <veselin.bochev@WKMZT0869FF7.global.publicisgroupe.net>
Wed, 8 Jun 2022 13:28:53 +0000 (16:28 +0300)
committerVeselin Bochev <veselin.bochev@WKMZT0869FF7.global.publicisgroupe.net>
Wed, 8 Jun 2022 13:28:53 +0000 (16:28 +0300)
bin/pre-terraform

index 5a27bce3f0222bdacc7f8d96750b0e62a5aa0b4d..6c532fdf402d7055c6b534de165052f90266c1fa 100755 (executable)
@@ -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