def update_astute_config(self, defaults=None, overwrites=None): """Update astute config and backup old one Read astute.yaml config file, update it with new config, copy old file to backup location and save new astute.yaml. """ # NOTE(ikalnitsky): we need to re-read astute.yaml in order protect # us from loosing some useful injection of another hook astute_config = copy.deepcopy(defaults or {}) astute_config = utils.dict_merge( astute_config, read_yaml_config(self.config.current_fuel_astute_path)) astute_config = utils.dict_merge( astute_config, overwrites or {}) # NOTE(eli): Just save file for backup in case # if user wants to restore it manually utils.copy_file( self.config.current_fuel_astute_path, '{0}_{1}'.format(self.config.current_fuel_astute_path, self.config.from_version), overwrite=False) utils.save_as_yaml(self.config.current_fuel_astute_path, astute_config)
def run(self): """Adds default credentials to config file """ # NOTE(ikalnitsky): we need to re-read astute.yaml in order protect # us from loosing some useful injection of another hook astute_config = deepcopy(self.credentials) astute_config.update( read_yaml_config(self.config.current_fuel_astute_path)) # NOTE(eli): Just save file for backup in case # if user wants to restore it manually utils.copy_file(self.config.current_fuel_astute_path, '{0}_{1}'.format(self.config.current_fuel_astute_path, self.config.from_version), overwrite=False) utils.save_as_yaml(self.config.current_fuel_astute_path, astute_config)
def run(self): """Adds default credentials to config file """ # NOTE(ikalnitsky): we need to re-read astute.yaml in order protect # us from loosing some useful injection of another hook astute_config = deepcopy(self.credentials) astute_config.update( read_yaml_config(self.config.current_fuel_astute_path)) # NOTE(eli): Just save file for backup in case # if user wants to restore it manually utils.copy_file( self.config.current_fuel_astute_path, '{0}_{1}'.format(self.config.current_fuel_astute_path, self.config.from_version), overwrite=False) utils.save_as_yaml(self.config.current_fuel_astute_path, astute_config)
def run(self): """Replaces config file with current DNS domain """ # NOTE(ikalnitsky): we need to re-read astute.yaml in order protect # us from loosing some useful injection of another hook astute_config = read_yaml_config(self.config.current_fuel_astute_path) hostname, sep, realdomain = os.uname()[1].partition('.') astute_config['DNS_DOMAIN'] = realdomain astute_config['DNS_SEARCH'] = realdomain # NOTE(mattymo): Just save file for backup in case # if user wants to restore it manually utils.copy_file(self.config.current_fuel_astute_path, '{0}_{1}'.format(self.config.current_fuel_astute_path, self.config.from_version), overwrite=False) utils.save_as_yaml(self.config.current_fuel_astute_path, astute_config)
def update_astute_config(self, defaults=None, overwrites=None): """Read astute.yaml config file, update it with new config, copy old file to backup location and save new astute.yaml. """ # NOTE(ikalnitsky): we need to re-read astute.yaml in order protect # us from loosing some useful injection of another hook astute_config = copy.deepcopy(defaults or {}) astute_config = utils.dict_merge( astute_config, read_yaml_config(self.config.current_fuel_astute_path)) astute_config = utils.dict_merge(astute_config, overwrites or {}) # NOTE(eli): Just save file for backup in case # if user wants to restore it manually utils.copy_file(self.config.current_fuel_astute_path, '{0}_{1}'.format(self.config.current_fuel_astute_path, self.config.from_version), overwrite=False) utils.save_as_yaml(self.config.current_fuel_astute_path, astute_config)
def run(self): """Replaces config file with current DNS domain """ # NOTE(ikalnitsky): we need to re-read astute.yaml in order protect # us from loosing some useful injection of another hook astute_config = read_yaml_config(self.config.current_fuel_astute_path) hostname, sep, realdomain = os.uname()[1].partition('.') astute_config['DNS_DOMAIN'] = realdomain astute_config['DNS_SEARCH'] = realdomain # NOTE(mattymo): Just save file for backup in case # if user wants to restore it manually utils.copy_file( self.config.current_fuel_astute_path, '{0}_{1}'.format(self.config.current_fuel_astute_path, self.config.from_version), overwrite=False) utils.save_as_yaml(self.config.current_fuel_astute_path, astute_config)