def set_sbd_config_on_node(report_processor, node_communicator, node, config, watchdog, device_list=None): """ Send SBD configuration to 'node' with specified watchdog set. Also puts correct node name into SBD_OPTS option (SBD_OPTS="-n <node_name>"). report_processor -- node_communicator -- NodeCommunicator node -- NodeAddresses config -- dictionary in format: <SBD config option>: <value> watchdog -- path to watchdog device device_list -- list of strings """ config = dict(config) config["SBD_OPTS"] = '"-n {node_name}"'.format(node_name=node.label) if watchdog: config["SBD_WATCHDOG_DEV"] = watchdog if device_list: config["SBD_DEVICE"] = '"{0}"'.format(";".join(device_list)) set_sbd_config(node_communicator, node, dict_to_environment_file(config)) report_processor.process(reports.sbd_config_accepted_by_node(node.label))
def test_success(self): cfg_dict = {"OPTION": "value", "ANOTHER": "option value", "ANOTHER ONE": '"complex value"'} expected = """# This file has been generated by pcs. ANOTHER=option value ANOTHER ONE="complex value" OPTION=value """ self.assertEqual(expected, tools.dict_to_environment_file(cfg_dict))
def create_sbd_config(base_config, node_label, watchdog, device_list=None): # TODO: figure out which name/ring has to be in SBD_OPTS config = dict(base_config) config["SBD_OPTS"] = '"-n {node_name}"'.format(node_name=node_label) if watchdog: config["SBD_WATCHDOG_DEV"] = watchdog if device_list: config["SBD_DEVICE"] = '"{0}"'.format(";".join(device_list)) return dict_to_environment_file(config)
def test_success(self): cfg_dict = { "OPTION": "value", "ANOTHER": "option value", "ANOTHER ONE": '"complex value"' } expected = """# This file has been generated by pcs. ANOTHER=option value ANOTHER ONE="complex value" OPTION=value """ self.assertEqual(expected, tools.dict_to_environment_file(cfg_dict))
def set_sbd_config_on_node(report_processor, node_communicator, node, config): """ Send SBD configuration to 'node'. Also puts correct node name into SBD_OPTS option (SBD_OPTS="-n <node_name>"). report_processor -- node_communicator -- NodeCommunicator node -- NodeAddresses config -- dictionary in format: <SBD config option>: <value> """ config = dict(config) config["SBD_OPTS"] = '"-n {node_name}"'.format(node_name=node.label) set_sbd_config(node_communicator, node, dict_to_environment_file(config)) report_processor.process( reports.sbd_config_accepted_by_node(node.label) )
def set_sbd_config_on_node( report_processor, node_communicator, node, config, watchdog ): """ Send SBD configuration to 'node' with specified watchdog set. Also puts correct node name into SBD_OPTS option (SBD_OPTS="-n <node_name>"). report_processor -- node_communicator -- NodeCommunicator node -- NodeAddresses config -- dictionary in format: <SBD config option>: <value> watchdog -- path to watchdog device """ config = dict(config) config["SBD_OPTS"] = '"-n {node_name}"'.format(node_name=node.label) if watchdog: config["SBD_WATCHDOG_DEV"] = watchdog set_sbd_config(node_communicator, node, dict_to_environment_file(config)) report_processor.process( reports.sbd_config_accepted_by_node(node.label) )