Пример #1
0
        try:
            server_val = parse_connection(opt.server, None, opt)
        except FormatError:
            _, err, _ = sys.exc_info()
            parser.error("Server connection values invalid: %s." % err)
        except UtilError:
            _, err, _ = sys.exc_info()
            parser.error("Server connection values invalid: %s." % err.errmsg)

    # Check specified source binlog directory.
    binlog_dir = None
    if opt.binlog_dir:
        # Check the access to the source binlog directory.
        binlog_dir = check_dir_option(parser,
                                      opt.binlog_dir,
                                      '--binlog-dir',
                                      check_access=True,
                                      read_only=True)

    # Check destination directory.
    num_args = len(args)
    if num_args < 1:
        parser.error("You must specify the destination directory as argument.")
    elif num_args > 1:
        parser.error("You can only specify one destination directory. "
                     "Multiple arguments found.")
    else:
        destination = get_absolute_path(args[0])
        if not os.path.isdir(destination):
            parser.error("The destination path specified as argument is not a "
                         "valid directory: {0}".format(args[0]))
Пример #2
0
    if opt.server:
        # Parse server connection values
        try:
            server_val = parse_connection(opt.server, None, opt)
        except FormatError:
            _, err, _ = sys.exc_info()
            parser.error("Server connection values invalid: %s." % err)
        except UtilError:
            _, err, _ = sys.exc_info()
            parser.error("Server connection values invalid: %s." % err.errmsg)

    # Check specified source binlog directory.
    binlog_dir = None
    if opt.binlog_dir:
        # Check the access to the source binlog directory.
        binlog_dir = check_dir_option(parser, opt.binlog_dir, '--binlog-dir',
                                      check_access=True, read_only=True)

    # Check destination directory.
    num_args = len(args)
    if num_args < 1:
        parser.error("You must specify the destination directory as argument.")
    elif num_args > 1:
        parser.error("You can only specify one destination directory. "
                     "Multiple arguments found.")
    else:
        destination = get_absolute_path(args[0])
        if not os.path.isdir(destination):
            parser.error("The destination path specified as argument is not a "
                         "valid directory: {0}".format(args[0]))
        if not os.access(destination, os.R_OK | os.W_OK):
            parser.error("You do not have enough privileges to access the "
Пример #3
0
    # Add force option
    parser.add_option("--force",
                      action="store_true",
                      dest="force",
                      default=False,
                      help="Ignore the maximum path length and the low space "
                      "checks for the --new-data option.")

    # Now we process the rest of the arguments.
    opt, args = parser.parse_args()

    # Check security settings
    check_password_security(opt, args)

    # Check the basedir option for errors (e.g., invalid path)
    check_dir_option(parser, opt.basedir, '--basedir')

    # Can only use --basedir and --datadir if --server is missing
    if opt.basedir is not None and opt.server is not None:
        parser.error("Cannot use the --basedir and --server options together.")

    # Fail if no database path specified.
    if opt.new_data is None:
        parser.error("No new database path. Use --help for available options.")

    # Warn if root-password is left off.
    if opt.root_pass is None or opt.root_pass == '':
        print("# WARNING: Root password for new instance has not been set.")

    # Fail if user does not have access to new data dir.
    if os.path.exists(opt.new_data):
Пример #4
0
                           "Default = 10.")

    # Add force option
    parser.add_option("--force", action="store_true", dest="force",
                      default=False,
                      help="Ignore the maximum path length and the low space "
                           "checks for the --new-data option.")

    # Now we process the rest of the arguments.
    opt, args = parser.parse_args()

    # Check security settings
    check_password_security(opt, args)

    # Check the basedir option for errors (e.g., invalid path)
    check_dir_option(parser, opt.basedir, '--basedir')

    # Can only use --basedir and --datadir if --server is missing
    if opt.basedir is not None and opt.server is not None:
        parser.error("Cannot use the --basedir and --server options together.")

    # Fail if no database path specified.
    if opt.new_data is None:
        parser.error("No new database path. Use --help for available options.")

    # Warn if root-password is left off.
    if opt.root_pass is None or opt.root_pass == '':
        print("# WARNING: Root password for new instance has not been set.")

    # Fail if user does not have access to new data dir.
    if os.path.exists(opt.new_data):
Пример #5
0
    # Add verbosity mode
    add_verbosity(parser, False)

    # Now we process the rest of the arguments.
    opt, args = parser.parse_args()

    # Check security settings
    check_password_security(opt, args)

    # The --basedir and --datadir options are only required if --start is used
    # otherwise they are ignored.
    if opt.start:
        # Check the basedir option for errors (e.g., invalid path).
        check_dir_option(parser,
                         opt.basedir,
                         '--basedir',
                         check_access=True,
                         read_only=True)

        # Check the datadir option for errors.
        check_dir_option(parser,
                         opt.datadir,
                         '--datadir',
                         check_access=True,
                         read_only=False)

    # Check start timeout for minimal value
    if int(opt.start_timeout) < 10:
        opt.start_timeout = 10
        print("# WARNING: --start-timeout must be >= 10 seconds. Using "
              "default value 10.")