class JenkinsHelper: jenkins_base_url = None jenkins_user = None jenkins_password = None logger = get_logger('JenkinsHelper') def __init__(self): self.__set_jenkins_config() def __set_jenkins_config(self): try: JenkinsHelper.jenkins_base_url = "http://" + os.environ[ 'JENKINS_BASE_URL'] JenkinsHelper.jenkins_user = os.environ['DAC_JENKINS_USER'] JenkinsHelper.jenkins_password = os.environ['DAC_JENKINS_PASSWORD'] except Exception as ex: self.logger.exception(ex) raise Exception( "Jenkins environment variables not set. Check JENKINS_BASE_URL are set" )
import time import traceback from python_terraform import Terraform from src.main.python.tranquilitybase.gcpdac.configuration.helpers.eaglehelper import EagleConfigHelper from src.main.python.tranquilitybase.gcpdac.configuration.helpers.envhelper import EnvHelper from src.main.python.tranquilitybase.gcpdac.main.core.terraform.terraform_config import get_terraform_path from src.main.python.tranquilitybase.lib.common.FileUtils import FileUtils from src.main.python.tranquilitybase.lib.common.StringUtils import is_none_or_empty # --- Logger --- import inspect from src.main.python.tranquilitybase.lib.common.local_logging import get_logger, get_frame_name logger = get_logger(get_frame_name(inspect.currentframe())) def validate_terraform_path(): terraform_source_path = get_terraform_path('folder_creation') if not FileUtils.dir_exists(terraform_source_path): raise Exception("terraform directory not found: " + terraform_source_path) if EnvHelper.is_ide(): logger.warn("running in IDE skipping terraform validation") return tf = Terraform(working_dir=terraform_source_path) terraform_plan(tf) def validate_terraform_config():
def init_gunicorn_logger(): gunicorn_logger = get_logger("gunicorn.info") global connex_app connex_app.app.logger.handlers = gunicorn_logger.handlers connex_app.app.logger.setLevel(gunicorn_logger.level)
def init_logging(): global logger logger = get_logger('tb-gcp-dac') logger.info("Logger initialised")