Repository: ambari Updated Branches: refs/heads/branch-2.2.2 719a63935 -> 08c6c1890
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/08c6c189 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/08c6c189 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/08c6c189 Branch: refs/heads/branch-2.2.2 Commit: 08c6c18907d8f35cce55eeaf9123db19fe34ce10 Parents: 719a639 Author: Sumit Mohanty <[email protected]> Authored: Wed Apr 27 14:54:54 2016 -0700 Committer: Sumit Mohanty <[email protected]> Committed: Wed Apr 27 14:54:54 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/08c6c189/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 a007817..40f8267 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 @@ -624,11 +624,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/08c6c189/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 21b4bff..8ffa720 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()
