From 052997403511261193987ac198f85316ecf5c486 Mon Sep 17 00:00:00 2001 From: Patryk Gudalewicz Date: Sun, 1 Jan 2023 16:27:39 +0100 Subject: [PATCH] Adjusting script and file names --- ...ate_alerting_profile.tf => _template_alerting.tf} | 0 environment.yaml | 12 ++++++++++++ environments.yaml | 0 onboarding.py | 6 ++++-- 4 files changed, 16 insertions(+), 2 deletions(-) rename _templates/{_template_alerting_profile.tf => _template_alerting.tf} (100%) create mode 100644 environment.yaml delete mode 100644 environments.yaml diff --git a/_templates/_template_alerting_profile.tf b/_templates/_template_alerting.tf similarity index 100% rename from _templates/_template_alerting_profile.tf rename to _templates/_template_alerting.tf diff --git a/environment.yaml b/environment.yaml new file mode 100644 index 00000000..7ffc9390 --- /dev/null +++ b/environment.yaml @@ -0,0 +1,12 @@ +EMEA_PROD: + - environments: [E2E,PROD] +EMEA_PREPROD: + - environments: [TEST,INT] +NA_PROD: + - environments: [E2E,PROD] +NA_PREPROD: + - environments: [TEST,INT] +CN_PROD: + - environments: [E2E,PROD] +CN_PREPROD: + - environments: [TEST,INT] \ No newline at end of file diff --git a/environments.yaml b/environments.yaml deleted file mode 100644 index e69de29b..00000000 diff --git a/onboarding.py b/onboarding.py index 9ea9e2d9..9aeed045 100644 --- a/onboarding.py +++ b/onboarding.py @@ -20,21 +20,23 @@ def main(slo_path): doc = yaml.safe_load(file) for item, doc in doc.items(): - envs = dict(doc[1]) + envs = dict(doc[0]) for configoption in configoptions: with open('./_templates/_template_'+configoption+'.tf') as file: data = file.read() data = data.replace("", args.appname) data = data.replace("", args.compassid.lower()) + #print('./'+item+'/'+configoption+'/'+args.appname+'.tf') with open('./'+item+'/'+configoption+'/'+args.appname+'.tf', 'w') as file: file.write(data) for envconfigoption in envconfigoptions: - for env in envs: + for env in envs.get("environments"): with open('./_templates/_template_'+envconfigoption+'.tf') as file: data = file.read() data = data.replace("", args.appname) data = data.replace("", args.compassid.lower()) data = data.replace("", env) + #print('./'+item+'/'+envconfigoption+'/'+args.appname+'_'+env+'.tf') with open('./'+item+'/'+envconfigoption+'/'+args.appname+'_'+env+'.tf', 'w') as file: file.write(data) else: