You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2017/11/02 13:42:17 UTC

ambari git commit: AMBARI-22349. Changing hostname causes ambari-agent start to fail (aonishuk)

Repository: ambari
Updated Branches:
  refs/heads/branch-3.0-perf a3745d204 -> 9095c910d


AMBARI-22349. Changing hostname causes ambari-agent start to fail (aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9095c910
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9095c910
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9095c910

Branch: refs/heads/branch-3.0-perf
Commit: 9095c910d8ca42023887779b59c9cfc5f49f9ea0
Parents: a3745d2
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Thu Nov 2 15:42:09 2017 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Thu Nov 2 15:42:09 2017 +0200

----------------------------------------------------------------------
 .../src/main/python/ambari_agent/ClusterTopologyCache.py      | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9095c910/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py b/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py
index e7ad8d2..0fdf38b 100644
--- a/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py
+++ b/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py
@@ -59,6 +59,7 @@ class ClusterTopologyCache(ClusterCache):
     components_by_key = defaultdict(lambda:{})
 
     for cluster_id, cluster_topology in self.iteritems():
+      self.current_host_ids_to_cluster[cluster_id] = None
       if 'hosts' in cluster_topology:
         for host_dict in cluster_topology.hosts:
           hosts_to_id[cluster_id][host_dict.hostId] = host_dict
@@ -72,8 +73,12 @@ class ClusterTopologyCache(ClusterCache):
           components_by_key[cluster_id][key] = component_dict
 
     for cluster_id, cluster_topology in self.iteritems():
-      current_host_id = self.current_host_ids_to_cluster[cluster_id]
       self.cluster_local_components[cluster_id] = []
+
+      if not cluster_id in self.current_host_ids_to_cluster:
+        continue
+
+      current_host_id = self.current_host_ids_to_cluster[cluster_id]
       for component_dict in self[cluster_id].components:
         if current_host_id in component_dict.hostIds:
           self.cluster_local_components[cluster_id].append(component_dict.componentName)