You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by am...@apache.org on 2018/08/02 09:03:20 UTC
[ambari] branch trunk updated: AMBARI-24390. Filter services
eligible for Ambari Single Sign-on Configuration if Kerberos is required
but not enabled (amagyar) (#1944)
This is an automated email from the ASF dual-hosted git repository.
amagyar pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push:
new 9ecc11e AMBARI-24390. Filter services eligible for Ambari Single Sign-on Configuration if Kerberos is required but not enabled (amagyar) (#1944)
9ecc11e is described below
commit 9ecc11e99b717bf061474c7af44ee4ba7ece0964
Author: Attila Magyar <m....@gmail.com>
AuthorDate: Thu Aug 2 11:03:16 2018 +0200
AMBARI-24390. Filter services eligible for Ambari Single Sign-on Configuration if Kerberos is required but not enabled (amagyar) (#1944)
---
.../src/main/python/ambari_server/setupSso.py | 10 +++++-----
ambari-server/src/test/python/TestSetupSso.py | 20 ++++++++++++++++----
2 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/ambari-server/src/main/python/ambari_server/setupSso.py b/ambari-server/src/main/python/ambari_server/setupSso.py
index 93eedab..8b3a041 100644
--- a/ambari-server/src/main/python/ambari_server/setupSso.py
+++ b/ambari-server/src/main/python/ambari_server/setupSso.py
@@ -53,7 +53,7 @@ REGEX_URL = "http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-
WILDCARD_FOR_ALL_SERVICES = "*"
SERVICE_NAME_AMBARI = 'AMBARI'
-FETCH_SERVICES_FOR_SSO_ENTRYPOINT = "clusters/%s/services?ServiceInfo/sso_integration_supported=true"
+FETCH_SERVICES_FOR_SSO_ENTRYPOINT = "clusters/%s/services?ServiceInfo/sso_integration_supported=true&fields=ServiceInfo/*"
SSO_CONFIG_API_ENTRYPOINT = 'services/AMBARI/components/AMBARI_SERVER/configurations/sso-configuration'
@@ -134,6 +134,9 @@ def populate_ambari_requires_sso(options, properties):
properties[AMBARI_SSO_AUTH_ENABLED] = 'true' if enabled else 'false'
+def eligible(service_info):
+ return service_info['sso_integration_supported'] \
+ and (not service_info['sso_integration_requires_kerberos'] or service_info['kerberos_enabled'])
def get_eligible_services(properties, admin_login, admin_password, cluster_name):
print_info_msg("Fetching SSO enabled services")
@@ -146,10 +149,7 @@ def get_eligible_services(properties, admin_login, admin_password, cluster_name)
services = []
if json_data and 'items' in json_data:
- items = json_data['items']
- if len(items) > 0:
- for item in items:
- services.append(item['ServiceInfo']['service_name'])
+ services = [item['ServiceInfo']['service_name'] for item in json_data['items'] if eligible(item['ServiceInfo'])]
if len(services) > 0:
print_info_msg('Found SSO enabled services: %s' % ', '.join(services))
diff --git a/ambari-server/src/test/python/TestSetupSso.py b/ambari-server/src/test/python/TestSetupSso.py
index ddc7e37..802c058 100644
--- a/ambari-server/src/test/python/TestSetupSso.py
+++ b/ambari-server/src/test/python/TestSetupSso.py
@@ -518,14 +518,20 @@ class TestSetupSso(unittest.TestCase):
"href": "http://c7401:8080/api/v1/clusters/cluster1/services/HDFS",
"ServiceInfo": {
"cluster_name": "cluster1",
- "service_name": "HDFS"
+ "service_name": "HDFS",
+ "sso_integration_supported": true,
+ "sso_integration_requires_kerberos": false,
+ "kerberos_enabled": false
}
},
{
"href": "http://c7401:8080/api/v1/clusters/cluster1/services/ZOOKEPER",
"ServiceInfo": {
"cluster_name": "cluster1",
- "service_name": "ZOOKEPER"
+ "service_name": "ZOOKEPER",
+ "sso_integration_supported": true,
+ "sso_integration_requires_kerberos": false,
+ "kerberos_enabled": false
}
}
]
@@ -538,14 +544,20 @@ class TestSetupSso(unittest.TestCase):
"href": "http://c7401:8080/api/v1/clusters/cluster1/services/HDFS",
"ServiceInfo": {
"cluster_name": "cluster1",
- "service_name": "HDFS"
+ "service_name": "HDFS",
+ "sso_integration_supported": True,
+ "sso_integration_requires_kerberos": False,
+ "kerberos_enabled": False
}
},
{
"href": "http://c7401:8080/api/v1/clusters/cluster1/services/ZOOKEPER",
"ServiceInfo": {
"cluster_name": "cluster1",
- "service_name": "ZOOKEPER"
+ "service_name": "ZOOKEPER",
+ "sso_integration_supported": True,
+ "sso_integration_requires_kerberos": False,
+ "kerberos_enabled": False
}
}
]