def __init__(self): log.info("Console config extractor initialized") self.__parser = argparse \ .ArgumentParser(description='Confuguration parser for backup application') self.__parser.add_argument('--source', required=False, type=str) self.__parser.add_argument('--target', required=False, type=str) self.__parser.add_argument('--comment', required=False, type=str)
def backup(self): # building configuration. Main source - console. additional(default) - yaml configuration self.__config = ConfigBuilder() \ .from_console() \ .from_yaml('configuration/configuration.yml') \ .get_configuration() target_name = self.__build_target_path() if ZipRunner.run_zip(self.__config.source, target_name): log.info( "Backup copy was successfully created: {}".format(target_name)) else: log.error("Backup wasn't created for source {}".format( self.__config.source))
from simple_log import simple_log as log dictionary = { 'first': 'first.com', 'second': 'second.com', 'third': 'third.com', 'fourth': 'fourth.com', 'fifth': 'fifth.com', } if __name__ == '__main__': log.info(dictionary) log.info(dictionary['first']) del dictionary['fifth'] log.info(dictionary) dictionary['fifth'] = int(123) log.info(dictionary) for key in dictionary.keys(): if str.startswith(key, 'f'): log.info("Keys with start character f: {0}".format(dictionary[key]))
def __init__(self, config): self.__config = config log.info("Config validator initialized for configuration {} ".format( config))
def __init__(self, path): log.info("Yaml config extractor initialized. Configuration location : {}".format(path)) self.configuration_path = path