From c7583c6548135151e2b944cf93053452a3d0f780 Mon Sep 17 00:00:00 2001 From: Veselin Bochev Date: Thu, 2 Jun 2022 12:51:51 +0300 Subject: [PATCH] minor fixes and defaults --- bin/pre-terraform | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) 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"] -- 2.39.5