예제 #1
0
                             add_help_option=False,
                             prog=program)

    # Default option to provide help information
    parser.add_option("--help",
                      action="help",
                      help="display this help message and exit")

    # Add --License option
    parser.add_option("--license",
                      action='callback',
                      callback=license_callback,
                      help="display program's license and exit")

    # Setup utility-specific options:
    add_failover_options(parser)

    # Interval for continuous mode
    parser.add_option("--interval",
                      "-i",
                      action="store",
                      dest="interval",
                      type="int",
                      default="15",
                      help="interval in seconds for polling the master for "
                      "failure and reporting health. Default = 15 "
                      "seconds. Lowest value is 5 seconds.")

    # Add failover modes
    parser.add_option("--failover-mode",
                      "-f",
예제 #2
0
DESCRIPTION = "mysqlrpladmin - administration utility for MySQL replication"
USAGE = "%prog --slaves=root@localhost:3306 <command>"
_DATE_FORMAT = '%Y-%m-%d %H:%M:%S %p'

# Setup the command parser
parser = MyParser(
    version=VERSION_FRM.format(program=os.path.basename(sys.argv[0])),
    description=DESCRIPTION,
    usage=USAGE,
    add_help_option=False,
    option_class=CaseInsensitiveChoicesOption,
    epilog=get_valid_rpl_command_text())
parser.add_option("--help", action="help")

# Setup utility-specific options:
add_failover_options(parser)

# Connection information for the master
# Connect information for candidate server for switchover
parser.add_option("--new-master", action="store", dest="new_master", default=None,
                  type="string", help="connection information for the "
                  "slave to be used to replace the master for switchover "
                  "in the form: <user>:<password>@<host>:<port>:<socket>. "
                  "Valid only with switchover command.")

# Force
parser.add_option("--force", action="store_true", dest="force",
                  help="ignore prerequsite check results and execute action")

# Output format
add_format_option(parser, "display the output in either grid (default), "