From: Veselin Bochev Date: Thu, 2 Jun 2022 09:51:51 +0000 (+0300) Subject: minor fixes and defaults X-Git-Tag: 1.6.1~1^2~10 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=c7583c6548135151e2b944cf93053452a3d0f780;p=pixelpark%2Fcreate-terraform.git minor fixes and defaults --- diff --git a/bin/pre-terraform b/bin/pre-terraform index 691cc48..9a6e2e8 100755 --- a/bin/pre-terraform +++ b/bin/pre-terraform @@ -134,21 +134,23 @@ sample_pre_tf = { try: print(f"OS according to facts: {data['os']['value']['name']} {data['os']['value']['release']['full']}\n") - # Nameservers resolv.conf - for ns in data["resolv_conf"]["value"]["nameserver"]: - sample_pre_tf["defaults"]["namservers"].append(ns) - - # Searchdomains resolv.conf - for sd in data["resolv_conf"]["value"]["search"]: - sample_pre_tf["defaults"]["searchdomains"].append(sd) - # Options resolv.conf try: timeout = data["resolv_conf"]["value"]["timeout"] attempts = data["resolv_conf"]["value"]["attempts"] + + # Nameservers resolv.conf + for ns in data["resolv_conf"]["value"]["nameserver"]: + sample_pre_tf["defaults"]["namservers"].append(ns) + + # Searchdomains resolv.conf + for sd in data["resolv_conf"]["value"]["search"]: + sample_pre_tf["defaults"]["searchdomains"].append(sd) except: timeout = 1 attempts = 2 + sample_pre_tf["defaults"]["namservers"] = [] + sample_pre_tf["defaults"]["searchdomains"] = [] sample_pre_tf["defaults"]["dns_options"] = f"timeout: {timeout} attempts: {attempts}" @@ -203,8 +205,8 @@ try: # Project sample_pre_tf["defaults"]["puppet"]["project"] = data["pp_owner"]["value"] - # Project - sample_pre_tf["defaults"]["purpose"] = data["pp_purpose"]["value"] + # Purpose + sample_pre_tf["defaults"]["purpose"] = data["pp_purpose"]["value"].split(' ')[0] # Environment sample_pre_tf["defaults"]["puppet"]["tier"] = data["tier"]["value"]