def get_parser(): """Parse command line options and return an OptionParser object """ parser = OptionParser(version="%prog "+core.get_api_version()) parser.add_option("-d", "--debug", action="store_true", dest="debug", default=core.cfg['API_DEBUG'], help="Enable debug mode") parser.add_option("-f", "--force-node", dest="node", metavar="hostname", default=None, help="Specify the node to operate with") parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=core.cfg['QUIET'], help="Quiet mode: suppress extra outputs") parser.add_option("-n", "--no-refresh", action="store_true", dest="norefresh", default=core.cfg['NOREFRESH'], help="Don't refresh LVM metadatas (DANGEROUS)") parser.add_option("-c", "--console", action="store_true", dest="console", default=False, help="Attach console to the domain as soon as it has started.") parser.usage = "%prog <subcommand> [args] [options]\n\n" parser.usage += get_help() parser.epilog = "For more help on 'cxm' see the cxm(1) man page." return parser
def get_parser(): """Parse command line options and return an OptionParser object """ parser = OptionParser(version="%prog "+core.get_api_version()) parser.add_option("-p", "--ping", action="store_true", dest="ping", default=False, help="Ping local daemon.") parser.add_option("-l", "--list-nodes", action="store_true", dest="listnodes", default=False, help="List currents nodes in the cluster.") parser.add_option("-s", "--status", action="store_true", dest="status", default=False, help="Print current daemon status.") parser.add_option("-d", "--dump", action="store_true", dest="dump", default=False, help="Dump current internal memory (usefull for debugging).") parser.add_option("-e", "--force-election", action="store_true", dest="election", default=False, help="Force a new master's election.") parser.add_option("-q", "--quit", action="store_true", dest="quit", default=False, help="Shutdown local daemon.") group = OptionGroup(parser, "Dangerous Options", "Be sure you understand what you're doing before use.") group.add_option("-f", "--format", action="store_true", dest="format", default=False, help="Format the heartbeat device.") group.add_option("--force-panic", action="store_true", dest="panic", default=False, help="Switch master into panic mode.") group.add_option("-r", "--recover", action="store_true", dest="recover", default=False, help="Recover from panic mode. Should be run on the master's node.") group.add_option("-k", "--kill", action="store", type="string", dest="kill", metavar="hostname", default=False, help="Remove the specified node from the cluster. You can't kill the master.") parser.add_option_group(group) parser.usage = "%prog option" parser.epilog = "For more help on 'cxmd_ctl' see the cxmd_ctl(1) man page." return parser