exportConfig.py updated.

master
SLW\ARNAUA 2022-01-11 14:21:56 +01:00
parent c5efb01320
commit 573418528e
1 changed files with 38 additions and 37 deletions

View File

@ -69,7 +69,7 @@ def checkdir(d):
if not os.listdir(d): if not os.listdir(d):
# [AA 2021.12.13] Delete Folder if empty # [AA 2021.12.13] Delete Folder if empty
print("[DEBUG]", "Found and deleting empty directory:", d) print("[DEBUG]", "Deleting empty directory:", d)
os.rmdir(d) os.rmdir(d)
else: else:
print("[DEBUG]", "Found directory:", d) print("[DEBUG]", "Found directory:", d)
@ -113,12 +113,13 @@ timestamp = time.strftime("%Y%m%d-%H%M%S")
load_dotenv() load_dotenv()
# [AA 2021.12.10] Set environments/tenants # [AA 2021.12.10] Set environments/tenants
Environments = ["EMEA_PROD"] Environments = ["EMEA_PROD"
# "EMEA_PREPROD", # "EMEA_PREPROD",
# "NA_PROD", # "NA_PROD",
# "NA_PREPROD", # "NA_PREPROD",
# "CN_PROD", # "CN_PROD",
# "CN_PREPROD"] # "CN_PREPROD"
]
# [AA 2021.12.10] Set available resources # [AA 2021.12.10] Set available resources
Resources = [ # "dynatrace_custom_service" Resources = [ # "dynatrace_custom_service"
@ -160,7 +161,7 @@ setdir = '.'
# [AA 2021.11.29] Arguments passed # [AA 2021.11.29] Arguments passed
if(len(sys.argv) == 1): if(len(sys.argv) == 1):
# [AA 2021.12.10] Loop through all four envirionments and two tenants # [AA 2021.12.10] Loop through all four environments and two tenants
for e in Environments: for e in Environments:
# [AA 2021.12.10] Set environment variables # [AA 2021.12.10] Set environment variables
@ -176,7 +177,7 @@ if(len(sys.argv) == 1):
copy("configuration.tf", copy("configuration.tf",
env['DYNATRACE_TARGET_FOLDER'] + "\\configuration.tf") env['DYNATRACE_TARGET_FOLDER'] + "\\configuration.tf")
# [AA, EW 2021.11.30] Iterate trough each folder in targetfolder, f...file/folder # [AA, EW 2021.11.30] Iterate trough each folder in targetfolder, f could mean file OR folder
for dirname in os.listdir(env['DYNATRACE_TARGET_FOLDER']): for dirname in os.listdir(env['DYNATRACE_TARGET_FOLDER']):
d, dflag = checkdir(os.path.join( d, dflag = checkdir(os.path.join(
env['DYNATRACE_TARGET_FOLDER'], dirname)) env['DYNATRACE_TARGET_FOLDER'], dirname))