You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by mp...@apache.org on 2018/04/24 19:18:28 UTC
[ambari] branch trunk updated: AMBARI-23660. Hosts topology can be
incomplete for components install during blueprint deploy. (#1073)
This is an automated email from the ASF dual-hosted git repository.
mpapirkovskyy 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 a064368 AMBARI-23660. Hosts topology can be incomplete for components install during blueprint deploy. (#1073)
a064368 is described below
commit a0643687a337925f991a1a6c5933b93513373244
Author: Myroslav Papirkovskyi <mp...@apache.org>
AuthorDate: Tue Apr 24 22:18:25 2018 +0300
AMBARI-23660. Hosts topology can be incomplete for components install during blueprint deploy. (#1073)
* AMBARI-23660. Hosts topology can be incomplete for components install during blueprint deploy. (mpapirkovskyy)
* AMBARI-23660. Hosts topology can be incomplete for components install during blueprint deploy. (mpapirkovskyy)
---
.../ambari_agent/CustomServiceOrchestrator.py | 45 ++++++++++++++++++++++
.../ambari/server/agent/ExecutionCommand.java | 1 -
2 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
index 0bf50d4..7cf89ad 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
@@ -543,6 +543,8 @@ class CustomServiceOrchestrator():
file_path = os.path.join(self.tmp_dir, "status_command.json")
else:
task_id = command['taskId']
+ if 'clusterHostInfo' in command and command['clusterHostInfo'] and not retry:
+ command['clusterHostInfo'] = self.decompressClusterHostInfo(command['clusterHostInfo'])
file_path = os.path.join(self.tmp_dir, "command-{0}.json".format(task_id))
if command_type == ActionQueue.AUTO_EXECUTION_COMMAND:
file_path = os.path.join(self.tmp_dir, "auto_command-{0}.json".format(task_id))
@@ -556,6 +558,49 @@ class CustomServiceOrchestrator():
f.write(content)
return file_path
+ def decompressClusterHostInfo(self, clusterHostInfo):
+ info = clusterHostInfo.copy()
+ #Pop info not related to host roles
+ hostsList = info.pop(self.HOSTS_LIST_KEY)
+ pingPorts = info.pop(self.PING_PORTS_KEY)
+ racks = info.pop(self.RACKS_KEY)
+ ipv4_addresses = info.pop(self.IPV4_ADDRESSES_KEY)
+
+ ambariServerHost = info.pop(self.AMBARI_SERVER_HOST)
+ ambariServerPort = info.pop(self.AMBARI_SERVER_PORT)
+ ambariServerUseSsl = info.pop(self.AMBARI_SERVER_USE_SSL)
+
+ decompressedMap = {}
+
+ for k,v in info.items():
+ # Convert from 1-3,5,6-8 to [1,2,3,5,6,7,8]
+ indexes = self.convertRangeToList(v)
+ # Convert from [1,2,3,5,6,7,8] to [host1,host2,host3...]
+ decompressedMap[k] = [hostsList[i] for i in indexes]
+
+ #Convert from ['1:0-2,4', '42:3,5-7'] to [1,1,1,42,1,42,42,42]
+ pingPorts = self.convertMappedRangeToList(pingPorts)
+ racks = self.convertMappedRangeToList(racks)
+ ipv4_addresses = self.convertMappedRangeToList(ipv4_addresses)
+
+ #Convert all elements to str
+ pingPorts = map(str, pingPorts)
+
+ #Add ping ports to result
+ decompressedMap[self.PING_PORTS_KEY] = pingPorts
+ #Add hosts list to result
+ decompressedMap[self.HOSTS_LIST_KEY] = hostsList
+ #Add racks list to result
+ decompressedMap[self.RACKS_KEY] = racks
+ #Add ips list to result
+ decompressedMap[self.IPV4_ADDRESSES_KEY] = ipv4_addresses
+ #Add ambari-server properties to result
+ decompressedMap[self.AMBARI_SERVER_HOST] = ambariServerHost
+ decompressedMap[self.AMBARI_SERVER_PORT] = ambariServerPort
+ decompressedMap[self.AMBARI_SERVER_USE_SSL] = ambariServerUseSsl
+
+ return decompressedMap
+
# Converts from 1-3,5,6-8 to [1,2,3,5,6,7,8]
def convertRangeToList(self, list):
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
index 0fbe047..41af327 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
@@ -97,7 +97,6 @@ public class ExecutionCommand extends AgentCommand {
private RoleCommand roleCommand;
@SerializedName("clusterHostInfo")
- @JsonIgnore
private Map<String, Set<String>> clusterHostInfo =
new HashMap<>();
--
To stop receiving notification emails like this one, please contact
mpapirkovskyy@apache.org.