Exemplo n.º 1
0
    # Now we process the rest of the arguments.
    opt, args = parser.parse_args()

    # Fail if no db arguments or --all option.
    if len(args) == 0 and not opt.all:
        parser.error(PARSE_ERR_DB_MISSING_CMP)

    # Check security settings
    check_password_security(opt, args, "# ")

    # Warn if quiet and verbosity are both specified
    check_verbosity(opt)

    # Fail if the --all option and database arguments are both specified.
    check_all(parser, opt, args, "databases")

    # Process --exclude values to remove unnecessary quotes (when used) in
    # order to avoid further matching issues.
    exclude_list = None
    if opt.exclude:
        if not opt.all:
            if not opt.quiet:
                print(WARN_OPT_ONLY_USED_WITH.format(opt='--exclude',
                                                     used_with='the --all'
                                                               ' option'))
        else:
            # Remove unnecessary outer quotes.
            exclude_list = [pattern.strip("'\"") for pattern in opt.exclude]

    # The --regexp option requires --exclude.
Exemplo n.º 2
0
    skips = check_skip_options(opt.skip_objects)
except UtilError, e:
    print "ERROR: %s" % e.errmsg
    exit(1)

# Fail if no options listed.
if opt.destination is None:
    parser.error("No destination server specified.")

# Fail if no db arguments or all
if len(args) == 0 and not opt.all:
    parser.error("You must specify at least one database to copy or "
                 "use the --all option to copy all databases.")
    
# Fail if we have arguments and all databases option listed.
check_all(parser, opt, args, "databases")

# Warn if quiet and verbosity are both specified
check_verbosity(opt)

# Set options for database operations.
options = {
    "skip_tables"      : "tables" in skips,
    "skip_views"       : "views" in skips,
    "skip_triggers"    : "triggers" in skips,
    "skip_procs"       : "procedures" in skips,
    "skip_funcs"       : "functions" in skips,
    "skip_events"      : "events" in skips,
    "skip_grants"      : "grants" in skips,
    "skip_create"      : "create_db" in skips,
    "skip_data"        : "data" in skips,