Пример #1
0
            else:
                tests_not_found.add(test)
        # Warn user about invalid tests for the --skip-tests option.
        if len(tests_not_found):
            print('\nWARNING: Some specified tests to skip do not match any '
                  'test to run: {0}.\n'.format(','.join(tests_not_found)))

    return tests_to_run


if __name__ == '__main__':
    # Check connector/python required version.
    check_connector_python()

    # Create argument parser.
    parser = options.GadgetsArgumentParser()

    parser.add_argument('tests',
                        metavar='TEST_NAME',
                        type=str,
                        nargs='*',
                        help='Unit test to execute. If none are specified '
                        'then all unit tests will be executed.')

    # Add version.
    options.add_version_option(parser)

    # Add verbose option.
    options.add_verbose_option(parser)

    # Add failfast option.
    # Add a new member to the previously created group:
    $ {script_name} join --instance=root@localhost:3397  \\
                          --peer-instance='root@localhost:3396'
""".format(script_name=_SCRIPT_NAME))

commands_desc = {
    CHECK: "Checks the configuration in a local options file.",
    HEALTH: "Shows the full status information for the replication group.",
    JOIN: "Checks requirements and adds an instance to the replication group.",
    LEAVE: "Removes an instance from the replication group.",
    START: "Configures a new group replication with the given instance.",
    STATUS: "Shows the status summary for the replication group.",
}

_PARSER = options.GadgetsArgumentParser(
    prog=_SCRIPT_NAME,
    formatter_class=argparse.RawDescriptionHelpFormatter,
    epilog=_EPILOGUE)

_NOT_REQUIRED_OPTIONS_MSG = ("The following options are not required for "
                             "command '{command}': {not_required}")

_ERROR_OPTION_REQ = "The {0} option is required for the {1} command."

_ERROR_OPTIONS_REQ = ("At least one of {0} options is required for the {1} "
                      "command.")

if __name__ == "__main__":
    # retrieve logger
    _LOGGER = logging.getLogger(_SCRIPT_NAME)

    # add version
Пример #3
0
# Check Python version requirement
check_python_version()

from mysql_gadgets.common import options, logger
from mysql_gadgets.command import clone
from mysql_gadgets.adapters import MYSQL_SOURCE, MYSQL_DEST

if __name__ == "__main__":
    # get script name
    script_name = os.path.splitext(os.path.split(__file__)[1])[0]
    # retrieve logger
    logging.setLoggerClass(logger.CustomLevelLogger)
    _LOGGER = logging.getLogger(__name__)

    parser = options.GadgetsArgumentParser(
        prog=script_name,
        formatter_class=argparse.RawDescriptionHelpFormatter)

    # add version
    options.add_version_option(parser)

    # add stdin password
    options.add_stdin_password_option(parser)

    # Add source server
    options.add_store_connection_option(parser, ["--source"], "source",
                                        ask_pass=True)

    # Add destination server
    options.add_store_connection_option(parser, ["--destination"],
                                        "destination", ask_pass=True)