优化代码并调整代码规范

This commit is contained in:
xue_meng_en
2021-03-05 10:51:04 +08:00
parent 445e15b759
commit 6256a1036a
2 changed files with 18 additions and 14 deletions

View File

@ -432,6 +432,8 @@ class ExpansionImpl():
resultMap, outputCollect = sshTool.getSshStatusOutput(command,
[primaryHost], self.envFile)
self.logger.debug(outputCollect)
if resultMap[primaryHost] != DefaultValue.SUCCESS:
GaussLog.exitWithError("Unable to query current cluster state.")
instances = re.split('(?:\|)|(?:\n)', outputCollect)
self.existingHosts = []
pattern = re.compile('(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}).*')
@ -964,9 +966,11 @@ remoteservice={remoteservice}'"
self.logger.debug("Start to check if the nodes in standby list.")
self.getExistingHosts()
newHostList = self.context.newHostList
existedNewHosts = list(set(self.existingHosts) & set(newHostList))
existedNewHosts = \
[host for host in newHostList if host in self.existingHosts]
if existedNewHosts:
newHostList = list(set(newHostList) - set(self.existingHosts))
newHostList = \
[host for host in newHostList if host not in existedNewHosts]
self.context.newHostList = newHostList
self.expansionSuccess = {}
for host in newHostList: