You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ds...@apache.org on 2018/06/15 08:53:40 UTC
[ambari] branch trunk updated: [AMBARI-24103] topology_script.py
return incorrect data (dsen) (#1534)
This is an automated email from the ASF dual-hosted git repository.
dsen 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 2eb647a [AMBARI-24103] topology_script.py return incorrect data (dsen) (#1534)
2eb647a is described below
commit 2eb647ae4bdee823e1839b8ded83afb004b58960
Author: Dmitry Sen <ds...@apache.org>
AuthorDate: Fri Jun 15 11:53:25 2018 +0300
[AMBARI-24103] topology_script.py return incorrect data (dsen) (#1534)
---
.../src/main/python/ambari_agent/ClusterTopologyCache.py | 13 +++++++++++++
.../server/controller/internal/HostResourceProvider.java | 3 +++
2 files changed, 16 insertions(+)
diff --git a/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py b/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py
index 830f202..6fe3af3 100644
--- a/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py
+++ b/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py
@@ -103,6 +103,19 @@ class ClusterTopologyCache(ClusterCache):
hostnames = [self.hosts_to_id[cluster_id][host_id].hostName for host_id in component_dict.hostIds]
cluster_host_info[component_name.lower()+"_hosts"] += hostnames
+ cluster_host_info['all_hosts'] = []
+ cluster_host_info['all_racks'] = []
+ cluster_host_info['all_ipv4_ips'] = []
+
+ for hosts_dict in self[cluster_id].hosts:
+ host_name = hosts_dict.hostName
+ rack_name = hosts_dict.rackName
+ ip = hosts_dict.ipv4
+
+ cluster_host_info['all_hosts'].append(host_name)
+ cluster_host_info['all_racks'].append(rack_name)
+ cluster_host_info['all_ipv4_ips'].append(ip)
+
self.cluster_host_info = cluster_host_info
return cluster_host_info
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
index 9831e80..8d787f5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
@@ -864,6 +864,9 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
boolean rackChange = updateHostRackInfoIfChanged(cluster, host, request);
+ if (rackChange) {
+ topologyHost.setRackName(host.getRackInfo());
+ }
if (null != request.getPublicHostName()) {
if(!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, resourceId, RoleAuthorization.HOST_ADD_DELETE_HOSTS)) {
--
To stop receiving notification emails like this one, please contact
dsen@apache.org.