Пример #1
0
                slave = Server({"conn_info": slave_val})
                parser.error(
                    ERROR_MASTER_IN_SLAVES.format(
                        master_host=master.host,
                        master_port=master.port,
                        slaves_candidates="slaves",
                        slave_host=slave.host,
                        slave_port=slave.port,
                    )
                )

    # Process list of databases/tables to exclude (check format errors).
    data_to_exclude = {}
    if opt.exclude:
        exclude_list = [val for val in opt.exclude.split(",") if val]
        data_to_exclude = db_objects_list_to_dictionary(parser, exclude_list, "the --exclude option")
    elif opt.exclude == "":
        # Issue an error if --exclude is used with no value.
        parser.error(PARSE_ERR_OPT_REQ_VALUE.format(opt="--exclude"))

    # Process list of databases/tables to include (check format errors).
    data_to_include = {}
    if args:
        data_to_include = db_objects_list_to_dictionary(parser, args, "the database/table " "arguments")

    # Create dictionary of options
    options = {
        "discover": opt.discover,
        "verbosity": 0 if opt.verbosity is None else opt.verbosity,
        "rpl_timeout": opt.rpl_timeout,
        "checksum_timeout": opt.checksum_timeout,
Пример #2
0
    except UtilError:
        _, err, _ = sys.exc_info()
        parser.error("Server connection values invalid: "
                     "{0!s}.".format(err.errmsg))

    # The --show=users can only be used together with the privilege option
    if opt.show_mode == 'users' and not opt.privileges:
        parser.error("The --show=users can only be used if you specify a "
                     "list of privileges with the --privileges option.")

    # Process list objects for which grants will be shown
    # (check format errors).
    objects_to_include = {}
    if args:
        objects_to_include = db_objects_list_to_dictionary(
            parser, args, 'list of objects to show the grants',
            db_over_tables=False)
    else:
        parser.error("You need to specify at least one object (database, table"
                     " or routine) in order to get the list of grantees.")

    # Validate list of privileges:
    priv_list = None
    if opt.privileges:
        priv_list = [priv.upper() for priv in opt.privileges.split(',')]
        if opt.verbosity and opt.verbosity > 2:
            print("The list of supported privileges is {0}".format(
                join_and_build_str(sorted(_VALID_PRIVS))))
        for priv in priv_list:
            if priv not in _VALID_PRIVS:
                if priv == "PROXY":
Пример #3
0
    except UtilError:
        _, err, _ = sys.exc_info()
        parser.error("Server connection values invalid: "
                     "{0!s}.".format(err.errmsg))

    # The --show=users can only be used together with the privilege option
    if opt.show_mode == 'users' and not opt.privileges:
        parser.error("The --show=users can only be used if you specify a "
                     "list of privileges with the --privileges option.")

    # Process list objects for which grants will be shown
    # (check format errors).
    objects_to_include = {}
    if args:
        objects_to_include = db_objects_list_to_dictionary(
            parser, args, 'list of objects to show the grants',
            db_over_tables=False)
    else:
        parser.error("You need to specify at least one object (database, table"
                     " or routine) in order to get the list of grantees.")

    # Validate list of privileges:
    priv_list = None
    if opt.privileges:
        priv_list = [priv.upper() for priv in opt.privileges.split(',')]
        if opt.verbosity and opt.verbosity > 2:
            print("The list of supported privileges is {0}".format(
                join_and_build_str(sorted(_VALID_PRIVS))))
        for priv in priv_list:
            if priv not in _VALID_PRIVS:
                if priv == "PROXY":