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 2018/06/29 18:02:39 UTC

[ambari] branch trunk updated: AMBARI-24223. Component with recovery Enabled are not coming up when autostart is enabled (aonishuk)

This is an automated email from the ASF dual-hosted git repository.

aonishuk pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 6bf4a5a  AMBARI-24223. Component with recovery Enabled are not coming up when autostart is enabled  (aonishuk)
6bf4a5a is described below

commit 6bf4a5a6caf805e3cfdf3134d95580ce6cae953a
Author: Andrew Onishuk <ao...@hortonworks.com>
AuthorDate: Fri Jun 29 19:09:46 2018 +0300

    AMBARI-24223. Component with recovery Enabled are not coming up when autostart is enabled  (aonishuk)
---
 ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py | 8 ++++++++
 ambari-agent/src/main/python/ambari_agent/ConfigurationBuilder.py | 1 +
 2 files changed, 9 insertions(+)

diff --git a/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py b/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py
index 6fe3af3..316885d 100644
--- a/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py
+++ b/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py
@@ -47,6 +47,7 @@ class ClusterTopologyCache(ClusterCache):
     self.current_host_ids_to_cluster = {}
     self.cluster_local_components = {}
     self.cluster_host_info = None
+    self.component_version_map = {}
     super(ClusterTopologyCache, self).__init__(cluster_cache_dir)
 
   def get_cache_name(self):
@@ -74,6 +75,7 @@ class ClusterTopologyCache(ClusterCache):
 
     for cluster_id, cluster_topology in self.iteritems():
       self.cluster_local_components[cluster_id] = []
+      self.component_version_map[cluster_id] = defaultdict(lambda:defaultdict(lambda: {}))
 
       if not self.current_host_ids_to_cluster[cluster_id]:
         continue
@@ -82,6 +84,9 @@ class ClusterTopologyCache(ClusterCache):
 
       if 'components' in self[cluster_id]:
         for component_dict in self[cluster_id].components:
+          if 'version' in component_dict.commandParams:
+            self.component_version_map[cluster_id][component_dict.serviceName][component_dict.componentName] = component_dict.commandParams.version
+
           if 'hostIds' in component_dict and current_host_id in component_dict.hostIds:
             if current_host_id in component_dict.hostIds:
               self.cluster_local_components[cluster_id].append(component_dict.componentName)
@@ -133,6 +138,9 @@ class ClusterTopologyCache(ClusterCache):
   def get_cluster_local_components(self, cluster_id):
     return self.cluster_local_components[cluster_id]
 
+  def get_cluster_component_version_map(self, cluster_id):
+    return self.component_version_map[cluster_id]
+
   def get_host_info_by_id(self, cluster_id, host_id):
     """
     Find host by id in list of host dictionaries.
diff --git a/ambari-agent/src/main/python/ambari_agent/ConfigurationBuilder.py b/ambari-agent/src/main/python/ambari_agent/ConfigurationBuilder.py
index 9d6a1ea..245aa81 100644
--- a/ambari-agent/src/main/python/ambari_agent/ConfigurationBuilder.py
+++ b/ambari-agent/src/main/python/ambari_agent/ConfigurationBuilder.py
@@ -42,6 +42,7 @@ class ConfigurationBuilder:
         'hostLevelParams': host_level_params_cache,
         'clusterHostInfo': self.topology_cache.get_cluster_host_info(cluster_id),
         'localComponents': self.topology_cache.get_cluster_local_components(cluster_id),
+        'componentVersionMap': self.topology_cache.get_cluster_component_version_map(cluster_id),
         'agentLevelParams': {'hostname': self.topology_cache.get_current_host_info(cluster_id)['hostName']},
         'clusterName': metadata_cache.clusterLevelParams.cluster_name
       }