Base_URL = options.url_base if options.url_base.endswith( "/") else options.url_base + '/' else: Base_URL = options.url_base if options.url_base.endswith( ":") else options.url_base + ':' CONFIG = FrozenDict( RootDir=os.path.dirname(os.path.realpath(__file__)), Requirements=(('git', 'gitpython==2.1.11'), ('colorama', 'colorama')), BaseRepo=f"{Base_URL}ScreamingBunny", ImageReplace=( ("base", r"gitlab.*?docker:alpine( as.*)?", r"alpine\g<1>\nRUN apk upgrade --update && apk add --no-cache dos2unix && rm /var/cache/apk/*" ), ("python3_twisted", r"gitlab.*plus:alpine-python3_twisted( as.*)?", fr"g2inc/oif-python_twisted\g<1>\nRUN apk upgrade --update && apk add --no-cache dos2unix && rm /var/cache/apk/*" ), ("python3", r"gitlab.*plus:alpine-python3( as.*)?", fr"g2inc/oif-python\g<1>\nRUN apk upgrade --update && apk add --no-cache dos2unix && rm /var/cache/apk/*" ), ), Repos=FrozenDict( Actuators=('ISR', ), Transport=('HTTPS', 'MQTT', 'CoAP'), )) # Utility Classes (Need Config) class Stage: def __init__(self, name='Stage', root=CONFIG.RootDir): self.name = name
log_file = open(options.log_file, "w+") log_file.write(f"Configure run at {init_now:%Y.%m.%d_%H:%M:%S}\n\n") log_file.flush() atexit.register(log_file.close) # Script Vars ItemCount = 1 RootDir = os.path.dirname(os.path.realpath(__file__)) CONFIG = FrozenDict( WorkDir=RootDir, Requirements=(("docker", "docker"), ("colorama", "colorama"), ("yaml", "pyyaml")), ImagePrefix="g2inc", Logging=FrozenDict(Default=( ("device", "-p device -f device-compose.yaml -f device-compose.log.yaml"), ), Central=(("device", "-p device -f device-compose.yaml"), )), Composes=tuple(file for file in os.listdir(RootDir) if re.match(r"^\w*?-compose(\.\w*?)?\.yaml$", file))) # Utility Functions def get_count(): global ItemCount c = ItemCount ItemCount += 1 return c
Base_URL = options.url_base if options.url_base.endswith( "/") else options.url_base + '/' else: Base_URL = options.url_base if options.url_base.endswith( ":") else options.url_base + ':' CONFIG = FrozenDict( RootDir=os.path.dirname(os.path.realpath(__file__)), Requirements=(('git', 'gitpython'), ('colorama', 'colorama')), BaseRepo=f"{Base_URL}ScreamingBunny", ImageReplace=( ("base", r"ccoe-gitlab.*?docker:alpine( as.*)?", r"oif/alpine\g<1>\nRUN apk upgrade --update && apk add --no-cache dos2unix && rm /var/cache/apk/*" ), ("python3_actuator", r"ccoe-gitlab.*plus:alpine-python3_actuator( as.*)?", fr"oif/python3_actuator\g<1>\nRUN apk upgrade --update && apk add --no-cache dos2unix && rm /var/cache/apk/*" ), ("python3", r"ccoe-gitlab.*plus:alpine-python3( as.*)?", fr"oif/python3\g<1>\nRUN apk upgrade --update && apk add --no-cache dos2unix && rm /var/cache/apk/*" ), ), Repos=FrozenDict( Orchestrator=('Producer-Core', 'GUI'), Transport=('HTTPS', 'MQTT'), )) # Utility Classes (Need Config) class Stage: def __init__(self, name='Stage', root=CONFIG.RootDir): self.name = name