From 57a4df73a5d05315d85dbccc2a9101bf0e15dc61 Mon Sep 17 00:00:00 2001 From: Kevin Falcone Date: Tue, 17 Nov 2015 12:47:01 -0500 Subject: [PATCH] Management commands should no longer access args[] https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/ Django intercepts the 'pull' argument and says "unrecognized arguments pull" There were no tests for this command, so it wasn't noticed during the upgrade testing, only once our integration monitoring noticed. --- .../third_party_auth/management/commands/saml.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/common/djangoapps/third_party_auth/management/commands/saml.py b/common/djangoapps/third_party_auth/management/commands/saml.py index 01918157ae..dd2c6c1049 100644 --- a/common/djangoapps/third_party_auth/management/commands/saml.py +++ b/common/djangoapps/third_party_auth/management/commands/saml.py @@ -12,16 +12,14 @@ class Command(BaseCommand): """ manage.py commands to manage SAML/Shibboleth SSO """ help = '''Configure/maintain/update SAML-based SSO''' - def handle(self, *args, **options): - if len(args) != 1: - raise CommandError("saml requires one argument: pull") + def add_arguments(self, parser): + parser.add_argument('--pull', action='store_true', help="Pull updated metadata from external IDPs") + def handle(self, *args, **options): if not SAMLConfiguration.is_enabled(): raise CommandError("SAML support is disabled via SAMLConfiguration.") - subcommand = args[0] - - if subcommand == "pull": + if options['pull']: log_handler = logging.StreamHandler(self.stdout) log_handler.setLevel(logging.DEBUG) log = logging.getLogger('third_party_auth.tasks')