|
@@ -78,10 +78,19 @@ class IdentityProviderBase(object):
|
|
|
self._allow_additional = True
|
|
|
|
|
|
@staticmethod
|
|
|
- def validate_idp_list(idp_list, openshift_version):
|
|
|
+ def validate_idp_list(idp_list, openshift_version, deployment_type):
|
|
|
''' validates a list of idps '''
|
|
|
login_providers = [x.name for x in idp_list if x.login]
|
|
|
- if len(login_providers) > 1 and LooseVersion(openshift_version) < LooseVersion('3.2'):
|
|
|
+
|
|
|
+ multiple_logins_unsupported = False
|
|
|
+ if len(login_providers) > 1:
|
|
|
+ if deployment_type in ['enterprise', 'online', 'atomic-enterprise', 'openshift-enterprise']:
|
|
|
+ if LooseVersion(openshift_version) < LooseVersion('3.2'):
|
|
|
+ multiple_logins_unsupported = True
|
|
|
+ if deployment_type in ['origin']:
|
|
|
+ if LooseVersion(openshift_version) < LooseVersion('1.2'):
|
|
|
+ multiple_logins_unsupported = True
|
|
|
+ if multiple_logins_unsupported:
|
|
|
raise errors.AnsibleFilterError("|failed multiple providers are "
|
|
|
"not allowed for login. login "
|
|
|
"providers: {0}".format(', '.join(login_providers)))
|
|
@@ -462,7 +471,7 @@ class FilterModule(object):
|
|
|
''' Custom ansible filters for use by the openshift_master role'''
|
|
|
|
|
|
@staticmethod
|
|
|
- def translate_idps(idps, api_version, openshift_version):
|
|
|
+ def translate_idps(idps, api_version, openshift_version, deployment_type):
|
|
|
''' Translates a list of dictionaries into a valid identityProviders config '''
|
|
|
idp_list = []
|
|
|
|
|
@@ -479,7 +488,7 @@ class FilterModule(object):
|
|
|
idp_list.append(idp_inst)
|
|
|
|
|
|
|
|
|
- IdentityProviderBase.validate_idp_list(idp_list, openshift_version)
|
|
|
+ IdentityProviderBase.validate_idp_list(idp_list, openshift_version, deployment_type)
|
|
|
return yaml.safe_dump([idp.to_dict() for idp in idp_list], default_flow_style=False)
|
|
|
|
|
|
@staticmethod
|