#!/usr/bin/env python """ Load Dynatrace Configuration Script. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . """ __author__ = "Arnautovic Arnel" __contact__ = "Arnel.Arnautovic@nttdata.com" __copyright__ = "Copyright 2021, NTT DATA" __credits__ = ["Ermis Wieger", "René Forstner"] __date__ = "2021/11/29" __deprecated__ = False __license__ = "GPLv3" __maintainer__ = "developer" __status__ = "Prototype" __version__ = "0.0.1" # [AA 2021.11.29] Import modules import os import subprocess import sys import time from dotenv import load_dotenv # [AA 2021.11.29] Load enviroment file load_dotenv() # [AA 2021.11.29] Arguments passed if(len(sys.argv) == 1): for i in ["EUPROD", "NAPROD", "EUPREPROD", "NAPREPROD", "CNPROD", "CNPREPROD"]: os.environ['DYNATRACE_ENV_URL'] = str(os.getenv(i + "_ENV_URL")) os.environ['DYNATRACE_API_TOKEN'] = str(os.getenv(i + "_API_TOKEN")) os.environ['DYNATRACE_TARGET_FOLDER'] = str( "./" + time.strftime("%Y%m%d-%H%M%S") + "_" + i + "_CONFIGURATION") subprocess.run(["terraform-provider-dynatrace_v1.8.4.exe", "export"]) else: print("Usage example: ") print("python .\loadConfig.py")