Repository: ambari Updated Branches: refs/heads/trunk fdb558887 -> daa87ea4d
AMBARI-17286 Service config links should use public host name (zhewang) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/daa87ea4 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/daa87ea4 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/daa87ea4 Branch: refs/heads/trunk Commit: daa87ea4dc09af7182f50321a0bbe025d1a65dbb Parents: fdb5588 Author: Zhe (Joe) Wang <[email protected]> Authored: Mon Jun 20 08:33:59 2016 -0700 Committer: Zhe (Joe) Wang <[email protected]> Committed: Mon Jun 20 08:33:59 2016 -0700 ---------------------------------------------------------------------- .../stacks/HDP/2.2/services/stack_advisor.py | 3 + .../stacks/HDP/2.3/services/stack_advisor.py | 3 + .../stacks/2.2/common/test_stack_advisor.py | 138 ++++++++++++++++++- .../stacks/2.3/common/test_stack_advisor.py | 3 + 4 files changed, 144 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/daa87ea4/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py index 038a6c3..753c692 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py @@ -774,6 +774,9 @@ class HDP22StackAdvisor(HDP21StackAdvisor): latest_tez_jar_version = None server_host = socket.getfqdn() + for host in hosts["items"]: + if server_host == host["Hosts"]["host_name"]: + server_host = host["Hosts"]["public_host_name"] server_port = '8080' server_protocol = 'http' views_dir = '/var/lib/ambari-server/resources/views/' http://git-wip-us.apache.org/repos/asf/ambari/blob/daa87ea4/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 c32306d..6a3df08 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 @@ -98,6 +98,9 @@ class HDP23StackAdvisor(HDP22StackAdvisor): latest_tez_jar_version = None server_host = socket.getfqdn() + for host in hosts["items"]: + if server_host == host["Hosts"]["host_name"]: + server_host = host["Hosts"]["public_host_name"] server_port = '8080' server_protocol = 'http' views_dir = '/var/lib/ambari-server/resources/views/' http://git-wip-us.apache.org/repos/asf/ambari/blob/daa87ea4/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py index 985e010..c6220bc 100644 --- a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py +++ b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py @@ -112,14 +112,60 @@ class TestHDP22StackAdvisor(TestCase): services = { "ambari-server-properties": {} } + hosts = { + "items" : [ + { + "href" : "/api/v1/hosts/c6401.ambari.apache.org", + "Hosts" : { + "cpu_count" : 1, + "host_name" : "c6401.ambari.apache.org", + "os_arch" : "x86_64", + "os_type" : "centos6", + "ph_cpu_count" : 1, + "public_host_name" : "c6401.ambari.apache.org", + "rack_info" : "/default-rack", + "total_mem" : 1922680 + } + }, + { + "href" : "/api/v1/hosts/c6402.ambari.apache.org", + "Hosts" : { + "cpu_count" : 1, + "host_name" : "c6402.ambari.apache.org", + "os_arch" : "x86_64", + "os_type" : "centos6", + "ph_cpu_count" : 1, + "public_host_name" : "c6402.ambari.apache.org", + "rack_info" : "/default-rack", + "total_mem" : 1922680 + } + }, + { + "href" : "/api/v1/hosts/c6403.ambari.apache.org", + "Hosts" : { + "cpu_count" : 1, + "host_name" : "c6403.ambari.apache.org", + "os_arch" : "x86_64", + "os_type" : "centos6", + "ph_cpu_count" : 1, + "public_host_name" : "c6403.ambari.apache.org", + "rack_info" : "/default-rack", + "total_mem" : 1922680 + } + } + ] + } server_host = socket.getfqdn() + for host in hosts["items"]: + if server_host == host["Hosts"]["host_name"]: + server_host = host["Hosts"]["public_host_name"] tez_ui_url = "http://" + server_host + ":8080/#/main/views/TEZ/0.7.0.2.3.0.0-2155/TEZ_CLUSTER_INSTANCE" services['ambari-server-properties'] = {'api.ssl': 'false'} expected['tez-site']['properties']['tez.tez-ui.history-url.base'] = tez_ui_url - self.stackAdvisor.recommendTezConfigurations(configurations, clusterData, services, None) + self.stackAdvisor.recommendTezConfigurations(configurations, clusterData, services, hosts) self.assertEquals(configurations, expected) def test_recommendTezConfigurations_amMemoryMoreThan3072(self): @@ -159,8 +205,51 @@ class TestHDP22StackAdvisor(TestCase): services = { "ambari-server-properties": {} } + hosts = { + "items" : [ + { + "href" : "/api/v1/hosts/c6401.ambari.apache.org", + "Hosts" : { + "cpu_count" : 1, + "host_name" : "c6401.ambari.apache.org", + "os_arch" : "x86_64", + "os_type" : "centos6", + "ph_cpu_count" : 1, + "public_host_name" : "c6401.ambari.apache.org", + "rack_info" : "/default-rack", + "total_mem" : 1922680 + } + }, + { + "href" : "/api/v1/hosts/c6402.ambari.apache.org", + "Hosts" : { + "cpu_count" : 1, + "host_name" : "c6402.ambari.apache.org", + "os_arch" : "x86_64", + "os_type" : "centos6", + "ph_cpu_count" : 1, + "public_host_name" : "c6402.ambari.apache.org", + "rack_info" : "/default-rack", + "total_mem" : 1922680 + } + }, + { + "href" : "/api/v1/hosts/c6403.ambari.apache.org", + "Hosts" : { + "cpu_count" : 1, + "host_name" : "c6403.ambari.apache.org", + "os_arch" : "x86_64", + "os_type" : "centos6", + "ph_cpu_count" : 1, + "public_host_name" : "c6403.ambari.apache.org", + "rack_info" : "/default-rack", + "total_mem" : 1922680 + } + } + ] + } - self.stackAdvisor.recommendTezConfigurations(configurations, clusterData, services, None) + self.stackAdvisor.recommendTezConfigurations(configurations, clusterData, services, hosts) self.assertEquals(configurations, expected) def test_recommendTezConfigurations_mapMemoryLessThan768(self): @@ -200,8 +289,51 @@ class TestHDP22StackAdvisor(TestCase): services = { "ambari-server-properties": {} } + hosts = { + "items" : [ + { + "href" : "/api/v1/hosts/c6401.ambari.apache.org", + "Hosts" : { + "cpu_count" : 1, + "host_name" : "c6401.ambari.apache.org", + "os_arch" : "x86_64", + "os_type" : "centos6", + "ph_cpu_count" : 1, + "public_host_name" : "c6401.ambari.apache.org", + "rack_info" : "/default-rack", + "total_mem" : 1922680 + } + }, + { + "href" : "/api/v1/hosts/c6402.ambari.apache.org", + "Hosts" : { + "cpu_count" : 1, + "host_name" : "c6402.ambari.apache.org", + "os_arch" : "x86_64", + "os_type" : "centos6", + "ph_cpu_count" : 1, + "public_host_name" : "c6402.ambari.apache.org", + "rack_info" : "/default-rack", + "total_mem" : 1922680 + } + }, + { + "href" : "/api/v1/hosts/c6403.ambari.apache.org", + "Hosts" : { + "cpu_count" : 1, + "host_name" : "c6403.ambari.apache.org", + "os_arch" : "x86_64", + "os_type" : "centos6", + "ph_cpu_count" : 1, + "public_host_name" : "c6403.ambari.apache.org", + "rack_info" : "/default-rack", + "total_mem" : 1922680 + } + } + ] + } - self.stackAdvisor.recommendTezConfigurations(configurations, clusterData, services, None) + self.stackAdvisor.recommendTezConfigurations(configurations, clusterData, services, hosts) self.assertEquals(configurations, expected) http://git-wip-us.apache.org/repos/asf/ambari/blob/daa87ea4/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 1bd385f..9d830da 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 @@ -1951,6 +1951,9 @@ class TestHDP23StackAdvisor(TestCase): self.assertEquals(configurations, expected) server_host = socket.getfqdn() + for host in hosts["items"]: + if server_host == host["Hosts"]["host_name"]: + server_host = host["Hosts"]["public_host_name"] tez_ui_url = "http://" + server_host + ":8080/#/main/views/TEZ/0.7.0.2.3.0.0-2155/TEZ_CLUSTER_INSTANCE" # Test JDK1.7
