def setUp(self): self.env_assist, self.config = get_env_tools(self) self.config.env.set_known_hosts_dests(KNOWN_HOSTS_DESTS) cib_xml_man = XmlManipulation.from_file(rc("cib-empty.xml")) cib_xml_man.append_to_first_tag_name( "resources", """ <primitive class="ocf" id="{0}" provider="heartbeat" type="VirtualDomain" /> """.format(VIRTUAL_MACHINE_ID) ) self.config.env.set_cib_data(str(cib_xml_man))
def fixture_status_xml(self, nodes, resources): xml_man = XmlManipulation.from_file(rc("crm_mon.minimal.xml")) doc = xml_man.tree.getroottree() doc.find("/summary/nodes_configured").set("number", str(nodes)) doc.find("/summary/resources_configured").set("number", str(resources)) return str(XmlManipulation(doc))
def fixture_status_xml(self, nodes, resources): xml_man = XmlManipulation.from_file(rc("crm_mon.minimal.xml")) doc = xml_man.tree.getroottree() doc.find("/summary/nodes_configured").set("number", str(nodes)) doc.find("/summary/resources_configured").set("number", str(resources)) return str(XmlManipulation(doc))
def set_cib_file(self, *xml_string_list): xml_manip = XmlManipulation.from_file(self.empty_cib) xml_manip.append_to_first_tag_name("resources", *xml_string_list) write_data_to_tmpfile(str(xml_manip), self.temp_cib)