diff options
author | Rodney Ewing <ewing.rj@gmail.com> | 2013-08-01 10:23:37 -0700 |
---|---|---|
committer | Rodney Ewing <ewing.rj@gmail.com> | 2013-08-16 15:30:12 -0700 |
commit | aa387fc57ec1c176a739df8c5f4cedaf70ae9af1 (patch) | |
tree | bd6ca7a50b59199fb0e1cdfc6d24755564811978 /mediagoblin/gmg_commands/import_export.py | |
parent | e7c08e3550d19691d989d48d8d499eb7b2b9f80a (diff) | |
download | mediagoblin-aa387fc57ec1c176a739df8c5f4cedaf70ae9af1.tar.lz mediagoblin-aa387fc57ec1c176a739df8c5f4cedaf70ae9af1.tar.xz mediagoblin-aa387fc57ec1c176a739df8c5f4cedaf70ae9af1.zip |
use parser.parse_known_args() instead of parser.parse_args()
Diffstat (limited to 'mediagoblin/gmg_commands/import_export.py')
-rw-r--r-- | mediagoblin/gmg_commands/import_export.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/mediagoblin/gmg_commands/import_export.py b/mediagoblin/gmg_commands/import_export.py index 98ec617d..2a624b96 100644 --- a/mediagoblin/gmg_commands/import_export.py +++ b/mediagoblin/gmg_commands/import_export.py @@ -96,27 +96,27 @@ def env_import(args): ''' Restore mongo database and media files from a tar archive ''' - if not args.cache_path: - args.cache_path = tempfile.mkdtemp() + if not args[0].cache_path: + args[0].cache_path = tempfile.mkdtemp() - setup_global_and_app_config(args.conf_file) + setup_global_and_app_config(args[0].conf_file) # Creates mg_globals.public_store and mg_globals.queue_store setup_storage() - global_config, app_config = setup_global_and_app_config(args.conf_file) + global_config, app_config = setup_global_and_app_config(args[0].conf_file) db = setup_connection_and_db_from_config( app_config) tf = tarfile.open( - args.tar_file, + args[0].tar_file, mode='r|gz') - tf.extractall(args.cache_path) + tf.extractall(args[0].cache_path) - args.cache_path = os.path.join( - args.cache_path, 'mediagoblin-data') - args = _setup_paths(args) + args[0].cache_path = os.path.join( + args[0].cache_path, 'mediagoblin-data') + args = _setup_paths(args[0]) # Import database from extracted data _import_database(db, args) @@ -224,16 +224,16 @@ def env_export(args): Export database and media files to a tar archive ''' if args.cache_path: - if os.path.exists(args.cache_path): + if os.path.exists(args[0].cache_path): _log.error('The cache directory must not exist ' 'before you run this script') - _log.error('Cache directory: {0}'.format(args.cache_path)) + _log.error('Cache directory: {0}'.format(args[0].cache_path)) return False else: - args.cache_path = tempfile.mkdtemp() + args[0].cache_path = tempfile.mkdtemp() - args = _setup_paths(args) + args = _setup_paths(args[0]) if not _export_check(args): _log.error('Checks did not pass, exiting') |