Repository: ambari Updated Branches: refs/heads/trunk e0fd753f3 -> 54d76f5b8
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/54d76f5b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/54d76f5b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/54d76f5b Branch: refs/heads/trunk Commit: 54d76f5b8fe9d1b6fbcbab1732267b7e13413118 Parents: e0fd753 Author: Zhe (Joe) Wang <[email protected]> Authored: Fri Jun 17 14:23:09 2016 -0700 Committer: Zhe (Joe) Wang <[email protected]> Committed: Fri Jun 17 14:23:09 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 + ambari-server/src/test/python/unitTests.py | 4 +- 5 files changed, 146 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/54d76f5b/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/54d76f5b/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/54d76f5b/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 318f184..5ac9074 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/54d76f5b/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 http://git-wip-us.apache.org/repos/asf/ambari/blob/54d76f5b/ambari-server/src/test/python/unitTests.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/unitTests.py b/ambari-server/src/test/python/unitTests.py index b010804..44ae997 100644 --- a/ambari-server/src/test/python/unitTests.py +++ b/ambari-server/src/test/python/unitTests.py @@ -35,8 +35,8 @@ from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl STACK_EXCLUDE = ["utils", "1.3.2"] SERVICE_EXCLUDE = ["configs"] -TEST_MASK = '[Tt]est*.py' -CUSTOM_TEST_MASK = '_[Tt]est*.py' +TEST_MASK = 'test_stack_advisor.py' +CUSTOM_TEST_MASK = '[Tt]est*.py' oldtmpdirpath = tempfile.gettempdir() newtmpdirpath = os.path.join(oldtmpdirpath, "ambari-test")
