Esempio n. 1
0
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
Esempio n. 2
0
def cd_(*args, **cmdoptions):
    utl.log_dev("args: %s\nopts: %s" % (repr(args), repr(cmdoptions)))
    if not cmdoptions["topic"]:
	utl.log_err("No topic specified")
	return 1

    if cmdoptions["topic"]:
	utl.set_topic(cmdoptions["topic"])
    if args:
	raise ReparseRequest()
    if utl.crm_topic not in utl.topic_stack:
	utl.topic_stack.append(cmdoptions["topic"])
    if not utl.global_opts["interactive"]:
	help(cmdoptions["topic"])
    return 0