def test_multi_agent_config(self): from chroma_agent.action_plugins.manage_pacemaker import configure_fencing agents = [{'agent': 'fence_virsh', 'ipaddr': '1.2.3.4', 'ipport': '22', 'login': '******', 'password': '******', 'plug': 'monkey_vm'}, {'agent': 'fence_apc', 'ipaddr': '4.3.2.1', 'ipport': '23', 'login': '******', 'password': '******', 'plug': '1'}] for field in ['agent', 'password', 'login']: self.add_command(('crm_attribute', '-D', '-t', 'nodes', '-U', self.fake_node_hostname, '-n', '0_fence_%s' % field)) for i, agent in enumerate(agents): for key in ['ipport', 'plug', 'ipaddr', 'login', 'password', 'agent']: # The fields are the order the comamnds should occur in self.add_command(('crm_attribute', '-t', 'nodes', '-U', self.fake_node_hostname, '-n', '%d_fence_%s' % (i, key), '-v', agent[key])) self.add_command(('cibadmin', '--modify', '--allow-create', '-o', 'crm_config', '-X', '<cluster_property_set id="cib-bootstrap-options">\n<nvpair id="cib-bootstrap-options-stonith-enabled" name="stonith-enabled" value="true"/>\n')) configure_fencing(agents) # HYD-2104: Ensure that the N_fence_agent attribute was added last. self.assertRanAllCommandsInOrder()
def test_multi_agent_config(self): from chroma_agent.action_plugins.manage_pacemaker import configure_fencing agents = [ { "agent": "fence_virsh", "ipaddr": "1.2.3.4", "ipport": "22", "login": "******", "password": "******", "plug": "monkey_vm", }, { "agent": "fence_apc", "ipaddr": "4.3.2.1", "ipport": "23", "login": "******", "password": "******", "plug": "1", }, ] for field in ["agent", "password", "login"]: self.add_command( ( "crm_attribute", "-D", "-t", "nodes", "-U", self.fake_node_hostname, "-n", "0_fence_%s" % field, ) ) for i, agent in enumerate(agents): for key in [ "ipport", "plug", "ipaddr", "login", "password", "agent", ]: # The fields are the order the comamnds should occur in self.add_command( ( "crm_attribute", "-t", "nodes", "-U", self.fake_node_hostname, "-n", "%d_fence_%s" % (i, key), "-v", agent[key], ) ) self.add_command( ( "cibadmin", "--modify", "--allow-create", "-o", "crm_config", "-X", '<cluster_property_set id="cib-bootstrap-options">\n<nvpair id="cib-bootstrap-options-stonith-enabled" name="stonith-enabled" value="true"/>\n', ) ) configure_fencing(agents) # HYD-2104: Ensure that the N_fence_agent attribute was added last. self.assertRanAllCommandsInOrder()