def apply_config(self, configs, skip_env_dependent=False, reconfigure=False): """Apply a configuration. If skip_env_dependent is True we're loading this locally to test the config as part of tronfig. We want to skip applying some settings because the local machine we're using to edit the config may not have the same environment as the live trond machine. """ master_config = configs[MASTER_NAMESPACE] self.output_stream_dir = master_config.output_stream_dir or self.working_dir if not skip_env_dependent: ssh_options = self._ssh_options_from_config(configs[MASTER_NAMESPACE].ssh_options) state_persistence = configs[MASTER_NAMESPACE].state_persistence else: ssh_options = config_parse.valid_ssh_options({}) state_persistence = config_parse.DEFAULT_STATE_PERSISTENCE self.state_manager = PersistenceManagerFactory.from_config( state_persistence) self.context.base = configs[MASTER_NAMESPACE].command_context self.time_zone = configs[MASTER_NAMESPACE].time_zone self._apply_nodes(configs[MASTER_NAMESPACE].nodes, ssh_options) self._apply_node_pools(configs[MASTER_NAMESPACE].node_pools) self._apply_notification_options(configs[MASTER_NAMESPACE].notification_options) jobs, services = collate_jobs_and_services(configs) self._apply_jobs(jobs, reconfigure=reconfigure) self._apply_services(services)
def apply_config(self, conf, skip_env_dependent=False, reconfigure=False): """Apply a configuration. If skip_env_dependent is True we're loading this locally to test the config as part of tronfig. We want to skip applying some settings because the local machine we're using to edit the config may not have the same environment as the live trond machine. """ self._apply_output_stream_directory(conf.output_stream_dir) if not skip_env_dependent: ssh_options = self._ssh_options_from_config(conf.ssh_options) else: ssh_options = config_parse.valid_ssh_options({}) self.context.base = conf.command_context self._apply_nodes(conf.nodes, ssh_options) self._apply_node_pools(conf.node_pools) self.time_zone = conf.time_zone self._apply_jobs(conf.jobs, reconfigure=reconfigure) self._apply_services(conf.services) self._apply_notification_options(conf.notification_options)