AMBARI-19080 Ambari stack-advisor error while adding knox service (mugdha)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/149104c2 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/149104c2 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/149104c2 Branch: refs/heads/branch-feature-AMBARI-18456 Commit: 149104c2713f320116fc63daea0260f3eafca61b Parents: a2f7a030 Author: Mugdha Varadkar <[email protected]> Authored: Tue Dec 6 14:13:59 2016 +0530 Committer: Mugdha Varadkar <[email protected]> Committed: Tue Dec 6 18:34:48 2016 +0530 ---------------------------------------------------------------------- .../stacks/HDP/2.3/services/stack_advisor.py | 4 ++- .../stacks/2.3/common/test_stack_advisor.py | 29 +++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/149104c2/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py index 5d34779..b6c83bd 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py @@ -768,7 +768,9 @@ class HDP23StackAdvisor(HDP22StackAdvisor): knox_port = '8443' if 'KNOX' in servicesList: knox_hosts = self.getComponentHostNames(services, "KNOX", "KNOX_GATEWAY") - knox_host = knox_hosts[0] + if len(knox_hosts) > 0: + knox_hosts.sort() + knox_host = knox_hosts[0] if 'gateway-site' in services['configurations'] and 'gateway.port' in services['configurations']["gateway-site"]["properties"]: knox_port = services['configurations']["gateway-site"]["properties"]['gateway.port'] putRangerAdminProperty('ranger.sso.providerurl', 'https://{0}:{1}/gateway/knoxsso/api/v1/websso'.format(knox_host, knox_port)) http://git-wip-us.apache.org/repos/asf/ambari/blob/149104c2/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py index b5ff24c..4a77086 100644 --- a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py +++ b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py @@ -1466,6 +1466,31 @@ class TestHDP23StackAdvisor(TestCase): } ] }, + { + "href": "/api/v1/stacks/HDP/versions/2.3/services/KNOX", + "StackServices": { + "service_name": "KNOX", + "service_version": "0.9.0.2.3", + "stack_name": "HDP", + "stack_version": "2.3" + }, + "components": [ + { + "href": "/api/v1/stacks/HDP/versions/2.3/services/KNOX/components/KNOX_GATEWAY", + "StackServiceComponents": { + "advertise_version": "false", + "cardinality": "1+", + "component_category": "MASTER", + "component_name": "KNOX_GATEWAY", + "display_name": "Knox Gateway", + "is_client": "false", + "is_master": "true", + "hostnames": ["c6401.ambari.apache.org"] + }, + "dependencies": [] + } + ] + } ], "configurations": { "admin-properties": { @@ -1477,6 +1502,7 @@ class TestHDP23StackAdvisor(TestCase): "properties": { "ranger.service.http.port": "7777", "ranger.service.http.enabled": "true", + "ranger.sso.providerurl": "", } } }, @@ -1519,7 +1545,8 @@ class TestHDP23StackAdvisor(TestCase): 'ranger-admin-site': { 'properties': { "ranger.audit.solr.zookeepers": "NONE", - "ranger.audit.source.type": "solr" + "ranger.audit.source.type": "solr", + "ranger.sso.providerurl": "https://c6401.ambari.apache.org:8443/gateway/knoxsso/api/v1/websso" } }, 'ranger-env': {
