def site_factory(): try: sf = testlib.SiteFactory(version=os.environ.get("VERSION", testlib.CMKVersion.DAILY), edition=os.environ.get("EDITION", testlib.CMKVersion.CEE), branch=os.environ.get("BRANCH", testlib.current_branch_name()), prefix="comp_") yield sf finally: sf.cleanup()
def _site_id(): site_id = os.environ.get("OMD_SITE") if site_id is not None: return site_id branch_name = os.environ.get("BRANCH", testlib.current_branch_name()) # Split by / and get last element, remove unwanted chars branch_part = re.sub("[^a-zA-Z0-9_]", "", branch_name.split("/")[-1]) site_id = "int_%s" % branch_part os.putenv("OMD_SITE", site_id) return site_id
def site_branch(): return os.environ.get("BRANCH", testlib.current_branch_name())