From bc22fa56dc80959575ac92b79752aceb9ceb872a Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 5 Oct 2020 22:15:20 -0700 Subject: [PATCH] Fix 500 when required LDAP group parameters aren't set. --- awx/sso/fields.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/awx/sso/fields.py b/awx/sso/fields.py index 78f750fbbd..e430a0a367 100644 --- a/awx/sso/fields.py +++ b/awx/sso/fields.py @@ -445,6 +445,7 @@ class LDAPGroupTypeField(fields.ChoiceField, DependsOnMixin): default_error_messages = { 'type_error': _('Expected an instance of LDAPGroupType but got {input_type} instead.'), + 'missing_parameters': _('Missing required parameters in {dependency}.') } def __init__(self, choices=None, **kwargs): @@ -479,7 +480,10 @@ class LDAPGroupTypeField(fields.ChoiceField, DependsOnMixin): if attr in params: params_sanitized[attr] = params[attr] - return cls(**params_sanitized) + try: + return cls(**params_sanitized) + except TypeError: + self.fail('missing_parameters', dependency=list(self.depends_on)[0]) class LDAPGroupTypeParamsField(fields.DictField, DependsOnMixin):