Repository: ambari Updated Branches: refs/heads/trunk 1c29f1df0 -> 116d98534
AMBARI-16144. Stack advisor scripts should handle calls where dependent services do not exist (smohanty) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/116d9853 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/116d9853 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/116d9853 Branch: refs/heads/trunk Commit: 116d9853461c6fc81e32a28c11b73ffb65849d44 Parents: 1c29f1d Author: Sumit Mohanty <[email protected]> Authored: Wed Apr 27 14:54:54 2016 -0700 Committer: Sumit Mohanty <[email protected]> Committed: Wed Apr 27 14:56:34 2016 -0700 ---------------------------------------------------------------------- .../stacks/HDP/2.0.6/services/stack_advisor.py | 13 ++++++++----- .../resources/stacks/HDP/2.3/services/stack_advisor.py | 7 ++++++- 2 files changed, 14 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/116d9853/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py index 6b3b1f5..1680f21 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py @@ -703,11 +703,14 @@ class HDP206StackAdvisor(DefaultStackAdvisor): # If no local DN in distributed mode if operatingMode == "distributed": dn_hosts = self.getComponentHostNames(services, "HDFS", "DATANODE") - if set(amsCollectorHosts).intersection(dn_hosts): - collector_cohosted_with_dn = "true" - else: - collector_cohosted_with_dn = "false" - putAmsHbaseSiteProperty("dfs.client.read.shortcircuit", collector_cohosted_with_dn) + # call by Kerberos wizard sends only the service being affected + # so it is possible for dn_hosts to be None but not amsCollectorHosts + if dn_hosts and len(dn_hosts) > 0: + if set(amsCollectorHosts).intersection(dn_hosts): + collector_cohosted_with_dn = "true" + else: + collector_cohosted_with_dn = "false" + putAmsHbaseSiteProperty("dfs.client.read.shortcircuit", collector_cohosted_with_dn) #split points scriptDir = os.path.dirname(os.path.abspath(__file__)) http://git-wip-us.apache.org/repos/asf/ambari/blob/116d9853/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 9f77129..d0ce196 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 @@ -133,7 +133,12 @@ class HDP23StackAdvisor(HDP22StackAdvisor): return parentItems def __getHosts(self, componentsList, componentName): - return [component["hostnames"] for component in componentsList if component["component_name"] == componentName][0] + host_lists = [component["hostnames"] for component in componentsList if + component["component_name"] == componentName] + if host_lists and len(host_lists) > 0: + return host_lists[0] + else: + return [] def getNotPreferableOnServerComponents(self): parentComponents = super(HDP23StackAdvisor, self).getNotPreferableOnServerComponents()
