def update_config(self, attributes, overwrite=True): for key, value in attributes.items(): attr = self.config path = key.split('.') for pth in path[:-1]: if pth not in attr: attr[pth] = AttributeDictionary() attr = attr[pth] if overwrite or path[-1] not in attr: attr[path[-1]] = value
def reset(self, basedir, test_mode): self.system = System.get_instance() self.config = AttributeDictionary() self.resources = {} self.resource_list = [] self.delayed_actions = set() self.test_mode = test_mode self.update_config({ # current time 'date': datetime.now(), # backups here files which were rewritten while executing File resource 'backup.path': '/tmp/resource_management/backup', # prefix for this files 'backup.prefix': datetime.now().strftime("%Y%m%d%H%M%S"), # dir where templates,failes dirs are 'basedir': basedir, # variables, which can be used in templates 'params': {}, })