def test_without_authfile(self, mock_parallel): lib.send_config_to_all_nodes(self.mock_communicator, self.mock_reporter, self.node_list, "cfg_name", "config data") mock_parallel.assert_called_once_with(lib._set_config_on_node, [([ self.mock_communicator, self.mock_reporter, node, "cfg_name", "config data", None, None ], {}) for node in self.node_list], self.mock_reporter, False) assert_report_item_list_equal( self.mock_reporter.report_item_list, [(Severities.INFO, report_codes.BOOTH_CONFIG_DISTRIBUTION_STARTED, {})])
def config_sync(env, name, skip_offline_nodes=False): """ Send specified local booth configuration to all nodes in cluster. env -- LibraryEnvironment name -- booth instance name skip_offline_nodes -- if True offline nodes will be skipped """ config = env.booth.get_config_content() authfile_path = config_structure.get_authfile(parse(config)) authfile_content = config_files.read_authfile(env.report_processor, authfile_path) sync.send_config_to_all_nodes(env.node_communicator(), env.report_processor, env.get_corosync_conf().get_nodes(), name, config, authfile=authfile_path, authfile_data=authfile_content, skip_offline=skip_offline_nodes)
def test_with_authfile(self, mock_parallel): lib.send_config_to_all_nodes( self.mock_communicator, self.mock_reporter, self.node_list, "cfg_name", "config data", authfile="/my/auth/file.key", authfile_data="authfile data".encode("utf-8") ) mock_parallel.assert_called_once_with( lib._set_config_on_node, [ ( [ self.mock_communicator, self.mock_reporter, node, "cfg_name", "config data", "/my/auth/file.key", "authfile data".encode("utf-8") ], {} ) for node in self.node_list ], self.mock_reporter, False ) assert_report_item_list_equal( self.mock_reporter.report_item_list, [( Severities.INFO, report_codes.BOOTH_DISTRIBUTING_CONFIG, {"name": "cfg_name"} )] )
def test_skip_offline(self, mock_parallel): lib.send_config_to_all_nodes( self.mock_communicator, self.mock_reporter, self.node_list, "cfg_name", "config data", skip_offline=True ) mock_parallel.assert_called_once_with( lib._set_config_on_node, [ ( [ self.mock_communicator, self.mock_reporter, node, "cfg_name", "config data", None, None ], {} ) for node in self.node_list ], self.mock_reporter, True ) assert_report_item_list_equal( self.mock_reporter.report_item_list, [( Severities.INFO, report_codes.BOOTH_DISTRIBUTING_CONFIG, {"name": "cfg_name"} )] )
def test_without_authfile(self, mock_parallel): lib.send_config_to_all_nodes( self.mock_communicator, self.mock_reporter, self.node_list, "cfg_name", "config data" ) mock_parallel.assert_called_once_with( lib._set_config_on_node, [ ( [ self.mock_communicator, self.mock_reporter, node, "cfg_name", "config data", None, None ], {} ) for node in self.node_list ], self.mock_reporter, False ) assert_report_item_list_equal( self.mock_reporter.report_item_list, [( Severities.INFO, report_codes.BOOTH_CONFIG_DISTRIBUTION_STARTED, {} )] )
def config_sync(env, name, skip_offline_nodes=False): """ Send specified local booth configuration to all nodes in cluster. env -- LibraryEnvironment name -- booth instance name skip_offline_nodes -- if True offline nodes will be skipped """ config = env.booth.get_config_content() authfile_path = config_structure.get_authfile(parse(config)) authfile_content = config_files.read_authfile( env.report_processor, authfile_path ) sync.send_config_to_all_nodes( env.node_communicator(), env.report_processor, env.get_corosync_conf().get_nodes(), name, config, authfile=authfile_path, authfile_data=authfile_content, skip_offline=skip_offline_nodes )