def do_show(self, context, node=None): 'usage: show [<node>]' cib_elem = xmlutil.cibdump2elem() if cib_elem is None: return False try: nodes_node = cib_elem.xpath("//configuration/nodes")[0] status = cib_elem.findall("status")[0] node_state = status.xpath(".//node_state") except: return False def is_offline(uname): for state in node_state: if state.get("uname") == uname and state.get("crmd") == "offline": return True return False for c in nodes_node.iterchildren(): if c.tag != "node" or (node is not None and c.get("uname") != node): continue print_node(*unpack_node_xmldata(c, is_offline))
def do_show(self, context, node=None): 'usage: show [<node>]' cib_elem = xmlutil.cibdump2elem() if cib_elem is None: return False try: nodes_node = cib_elem.xpath("//configuration/nodes")[0] status = cib_elem.findall("status")[0] except: return False for c in nodes_node.iterchildren(): if c.tag != "node": continue if node is not None and c.get("uname") != node: continue type = uname = id = "" inst_attr = [] other = {} for attr in c.keys(): v = c.get(attr) if attr == "type": type = v elif attr == "uname": uname = v elif attr == "id": id = v else: other[attr] = v for c2 in c.iterchildren(): if c2.tag == "instance_attributes": inst_attr += nvpairs2list(c2) offline = False for c2 in status.xpath(".//node_state"): if uname != c2.get("uname"): continue offline = c2.get("crmd") == "offline" print_node(uname, id, type, other, inst_attr, offline)
def do_show(self, context, node=None): 'usage: show [<node>]' cib_elem = xmlutil.cibdump2elem() if cib_elem is None: return False try: nodes_node = cib_elem.xpath("//configuration/nodes")[0] status = cib_elem.findall("status")[0] node_state = status.xpath(".//node_state") except: return False def is_offline(uname): for state in node_state: if state.get("uname") == uname and state.get( "crmd") == "offline": return True return False for c in nodes_node.iterchildren(): if c.tag != "node" or (node is not None and c.get("uname") != node): continue print_node(*unpack_node_xmldata(c, is_offline))