diff options
-rw-r--r-- | mediagoblin/gmg_commands/assetlink.py | 1 | ||||
-rw-r--r-- | mediagoblin/gmg_commands/dbupdate.py | 2 | ||||
-rw-r--r-- | mediagoblin/gmg_commands/import_export.py | 3 | ||||
-rw-r--r-- | mediagoblin/gmg_commands/shell.py | 1 | ||||
-rw-r--r-- | mediagoblin/gmg_commands/users.py | 3 | ||||
-rw-r--r-- | mediagoblin/gmg_commands/util.py | 9 |
6 files changed, 18 insertions, 1 deletions
diff --git a/mediagoblin/gmg_commands/assetlink.py b/mediagoblin/gmg_commands/assetlink.py index 49e27e33..dff737ff 100644 --- a/mediagoblin/gmg_commands/assetlink.py +++ b/mediagoblin/gmg_commands/assetlink.py @@ -138,6 +138,7 @@ def assetlink(args): """ Link the asset directory of the currently installed theme and plugins """ + commands_util.check_unrecognized_args(args) mgoblin_app = commands_util.setup_app(args[0]) app_config = mg_globals.app_config diff --git a/mediagoblin/gmg_commands/dbupdate.py b/mediagoblin/gmg_commands/dbupdate.py index fb533d0a..b2efa5de 100644 --- a/mediagoblin/gmg_commands/dbupdate.py +++ b/mediagoblin/gmg_commands/dbupdate.py @@ -20,6 +20,7 @@ from sqlalchemy.orm import sessionmaker from mediagoblin.db.open import setup_connection_and_db_from_config from mediagoblin.db.migration_tools import MigrationManager +from mediagoblin.gmg_commands import util as commands_util from mediagoblin.init import setup_global_and_app_config from mediagoblin.tools.common import import_component @@ -147,5 +148,6 @@ def run_all_migrations(db, app_config, global_config): def dbupdate(args): + commands_util.check_unrecognized_args(args) global_config, app_config = setup_global_and_app_config(args[0].conf_file) run_dbupdate(app_config, global_config) diff --git a/mediagoblin/gmg_commands/import_export.py b/mediagoblin/gmg_commands/import_export.py index 2a624b96..1d4ae1f7 100644 --- a/mediagoblin/gmg_commands/import_export.py +++ b/mediagoblin/gmg_commands/import_export.py @@ -16,6 +16,7 @@ from mediagoblin import mg_globals from mediagoblin.db.open import setup_connection_and_db_from_config +from mediagoblin.gmg_commands import util as commands_util from mediagoblin.storage.filestorage import BasicFileStorage from mediagoblin.init import setup_storage, setup_global_and_app_config @@ -96,6 +97,7 @@ def env_import(args): ''' Restore mongo database and media files from a tar archive ''' + commands_util.check_unrecognized_args(args) if not args[0].cache_path: args[0].cache_path = tempfile.mkdtemp() @@ -223,6 +225,7 @@ def env_export(args): ''' Export database and media files to a tar archive ''' + commands_util.check_unrecognized_args(args) if args.cache_path: if os.path.exists(args[0].cache_path): _log.error('The cache directory must not exist ' diff --git a/mediagoblin/gmg_commands/shell.py b/mediagoblin/gmg_commands/shell.py index b19af837..03e08b23 100644 --- a/mediagoblin/gmg_commands/shell.py +++ b/mediagoblin/gmg_commands/shell.py @@ -63,6 +63,7 @@ def shell(args): """ Setup a shell for the user either a normal Python shell or an IPython one """ + commands_util.check_unrecognized_args(args) user_namespace = { 'mg_globals': mg_globals, 'mgoblin_app': commands_util.setup_app(args[0]), diff --git a/mediagoblin/gmg_commands/users.py b/mediagoblin/gmg_commands/users.py index c2a4dddb..b164e672 100644 --- a/mediagoblin/gmg_commands/users.py +++ b/mediagoblin/gmg_commands/users.py @@ -32,6 +32,7 @@ def adduser_parser_setup(subparser): def adduser(args): #TODO: Lets trust admins this do not validate Emails :) + commands_util.check_unrecognized_args(args) commands_util.setup_app(args[0]) args[0].username = commands_util.prompt_if_not_set(args[0].username, "Username:") @@ -67,6 +68,7 @@ def makeadmin_parser_setup(subparser): def makeadmin(args): + commands_util.check_unrecognized_args(args) commands_util.setup_app(args[0]) db = mg_globals.database @@ -91,6 +93,7 @@ def changepw_parser_setup(subparser): def changepw(args): + commands_util.check_unrecognized_args(args) commands_util.setup_app(args[0]) db = mg_globals.database diff --git a/mediagoblin/gmg_commands/util.py b/mediagoblin/gmg_commands/util.py index 6a6853d5..8b057996 100644 --- a/mediagoblin/gmg_commands/util.py +++ b/mediagoblin/gmg_commands/util.py @@ -17,6 +17,7 @@ from mediagoblin import app import getpass +import argparse def setup_app(args): @@ -36,5 +37,11 @@ def prompt_if_not_set(variable, text, password=False): variable=raw_input(text + u' ') else: variable=getpass.getpass(text + u' ') - + return variable + + +def check_unrecognized_args(args): + if args[1]: + parser = argparse.ArgumentParser() + parser.error('unrecognized arguments: {}'.format(args[1])) |