if opt.master_log_pos >= 0 and opt.master_log_file is None:
        parser.error("You must specify a master log file to use the master " "log file position option.")

    if (opt.master_log_pos >= 0 or (opt.master_log_file is not None)) and opt.from_beginning:
        parser.error(
            "The --start-from-beginning option is not valid in "
            "combination with --master-log-file or --master-log-pos."
        )

    # Create dictionary of options
    options = {
        "verbosity": opt.verbosity,
        "pedantic": opt.pedantic,
        "quiet": False,
        "master_log_file": opt.master_log_file,
        "master_log_pos": opt.master_log_pos,
        "from_beginning": opt.from_beginning,
    }

    # Add ssl Values to options instead of connection.
    options.update(get_ssl_dict(opt))

    try:
        setup_replication(m_values, s_values, opt.rpl_user, options, opt.test_db)
    except UtilError:
        _, e, _ = sys.exc_info()
        print("ERROR: {0}".format(e.errmsg))
        sys.exit(1)

    sys.exit()
Пример #2
0
        parser.error("You must specify a master log file to use the master "
                     "log file position option.")

    if ((opt.master_log_pos >= 0 or (opt.master_log_file is not None))
            and opt.from_beginning):
        parser.error("The --start-from-beginning option is not valid in "
                     "combination with --master-log-file or --master-log-pos.")

    # Create dictionary of options
    options = {
        'verbosity': opt.verbosity,
        'pedantic': opt.pedantic,
        'quiet': False,
        'master_log_file': opt.master_log_file,
        'master_log_pos': opt.master_log_pos,
        'from_beginning': opt.from_beginning,
    }

    # Add ssl Values to options instead of connection.
    options.update(get_ssl_dict(opt))

    try:
        setup_replication(m_values, s_values, opt.rpl_user, options,
                          opt.test_db)
    except UtilError:
        _, e, _ = sys.exc_info()
        print("ERROR: {0}".format(e.errmsg))
        sys.exit(1)

    sys.exit()