summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2016-02-11 07:50:05 -0500
committerBrenton Leanhardt <bleanhar@redhat.com>2016-02-11 07:50:05 -0500
commit6b2edf68b223d8cba28fc96700651059c87a423a (patch)
tree0431c1b092289c575e64a0fe64dfe9f1dd5b8d30
parentff6088c661af6e1854fcb27feddf386db85b3cd4 (diff)
parent1262c7e948f93a183b51b9160c554415de9082e7 (diff)
downloadopenshift-6b2edf68b223d8cba28fc96700651059c87a423a.tar.gz
openshift-6b2edf68b223d8cba28fc96700651059c87a423a.tar.bz2
openshift-6b2edf68b223d8cba28fc96700651059c87a423a.tar.xz
openshift-6b2edf68b223d8cba28fc96700651059c87a423a.zip
Merge pull request #1367 from detiber/githubOrg
Add organizations attribute to github identity provider
-rw-r--r--filter_plugins/openshift_master.py27
1 files changed, 20 insertions, 7 deletions
diff --git a/filter_plugins/openshift_master.py b/filter_plugins/openshift_master.py
index 35a881a85..c41367f05 100644
--- a/filter_plugins/openshift_master.py
+++ b/filter_plugins/openshift_master.py
@@ -53,7 +53,20 @@ class IdentityProviderBase(object):
self.challenge = ansible_bool(self._idp.pop('challenge', False))
self.provider = dict(apiVersion=api_version, kind=self._idp.pop('kind'))
- self._required = [['mappingMethod', 'mapping_method']]
+ mm_keys = ('mappingMethod', 'mapping_method')
+ mapping_method = None
+ for key in mm_keys:
+ if key in self._idp:
+ mapping_method = self._idp[key]
+ if mapping_method is None:
+ mapping_method = self.get_default('mappingMethod')
+ self.mapping_method = mapping_method
+
+ valid_mapping_methods = ['add', 'claim', 'generate', 'lookup']
+ if self.mapping_method not in valid_mapping_methods:
+ raise errors.AnsibleFilterError("|failed unkown mapping method "
+ "for provider {0}".format(self.__class__.__name__))
+ self._required = []
self._optional = []
self._allow_additional = True
@@ -75,10 +88,7 @@ class IdentityProviderBase(object):
def validate(self):
''' validate an instance of this idp class '''
- valid_mapping_methods = ['add', 'claim', 'generate', 'lookup']
- if self.provider['mappingMethod'] not in valid_mapping_methods:
- raise errors.AnsibleFilterError("|failed unkown mapping method "
- "for provider {0}".format(self.__class__.__name__))
+ pass
@staticmethod
def get_default(key):
@@ -121,7 +131,8 @@ class IdentityProviderBase(object):
def to_dict(self):
''' translate this idp to a dictionary '''
return dict(name=self.name, challenge=self.challenge,
- login=self.login, provider=self.provider)
+ login=self.login, mappingMethod=self.mapping_method,
+ provider=self.provider)
class LDAPPasswordIdentityProvider(IdentityProviderBase):
@@ -436,7 +447,9 @@ class GitHubIdentityProvider(IdentityProviderOauthBase):
Raises:
AnsibleFilterError:
"""
- pass
+ def __init__(self, api_version, idp):
+ IdentityProviderOauthBase.__init__(self, api_version, idp)
+ self._optional += [['organizations']]
class FilterModule(object):