def do_status(*args, **cmdoptions): topic = utl.crm_topic if cmdoptions.has_key("topic") and cmdoptions["topic"]: topic = cmdoptions["topic"] if topic == "resources": if not args: utl.os_system("crm_resource -L", True) for rsc in args: utl.os_system("crm_resource -W -r %s"%rsc, True) elif topic == "nodes": lines = utl.os_system("cibadmin -Q -o status", False) for line in lines: line = line.rstrip() utl.log_dev("status line: "+line) if line.find("node_state ") >= 0: if not args: print line for node in args: if line.find(node) >= 0: print line else: utl.log_err("Topic %s is not (yet) supported" % topic) return 1 return 0
def do_list(*args, **cmdoptions): topic = utl.crm_topic if cmdoptions.has_key("topic") and cmdoptions["topic"]: topic = cmdoptions["topic"] utl.log_debug("Complete '%s' listing" % topic) if topic == "resources": utl.os_system("crm_resource -l", True) elif topic == "nodes": lines = utl.os_system("cibadmin -Q -o nodes", False) for line in lines: if line.find("node ") >= 0: print line.rstrip() else: utl.log_err("%s: Topic %s is not (yet) supported" % ("list", topic)) return 1 return 0