summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2016-03-28 13:28:38 -0400
committerBrenton Leanhardt <bleanhar@redhat.com>2016-03-28 13:28:38 -0400
commite1f6415cbcc4145402011fb4183a5dead2f22124 (patch)
treedcc2ac44274513a34f5a23a9a6b2548df08b87ea
parent1436e46e0bb2f3d2627c2f27cf7f27888d7aad55 (diff)
parent3e76266c6131d65f239481bc182ac22a4dd6f8ce (diff)
downloadopenshift-e1f6415cbcc4145402011fb4183a5dead2f22124.tar.gz
openshift-e1f6415cbcc4145402011fb4183a5dead2f22124.tar.bz2
openshift-e1f6415cbcc4145402011fb4183a5dead2f22124.tar.xz
openshift-e1f6415cbcc4145402011fb4183a5dead2f22124.zip
Merge pull request #1592 from detiber/fixAuthFilter
Attempt to fix error validating when extraScopes and extraAuthorizePa…
-rw-r--r--filter_plugins/openshift_master.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/filter_plugins/openshift_master.py b/filter_plugins/openshift_master.py
index 3a1d77f53..d0fb98ec3 100644
--- a/filter_plugins/openshift_master.py
+++ b/filter_plugins/openshift_master.py
@@ -372,13 +372,12 @@ class OpenIDIdentityProvider(IdentityProviderOauthBase):
raise errors.AnsibleFilterError("|failed claims for provider {0} "
"must be a dictionary".format(self.__class__.__name__))
- if 'extraScopes' not in self.provider['extraScopes'] and not isinstance(self.provider['extraScopes'], list):
- raise errors.AnsibleFilterError("|failed extraScopes for provider "
- "{0} must be a list".format(self.__class__.__name__))
- if ('extraAuthorizeParameters' not in self.provider['extraAuthorizeParameters']
- and not isinstance(self.provider['extraAuthorizeParameters'], dict)):
- raise errors.AnsibleFilterError("|failed extraAuthorizeParameters "
- "for provider {0} must be a dictionary".format(self.__class__.__name__))
+ for var, var_type in (('extraScopes', list), ('extraAuthorizeParameters', dict)):
+ if var in self.provider and not isinstance(self.provider[var], var_type):
+ raise errors.AnsibleFilterError("|failed {1} for provider "
+ "{0} must be a {2}".format(self.__class__.__name__,
+ var,
+ var_type.__class__.__name__))
required_claims = ['id']
optional_claims = ['email', 'name', 'preferredUsername']