互信脚本问题修复

This commit is contained in:
hangjin2020 2021-01-26 17:33:40 +08:00
parent 94810cb0fe
commit df559c554e
2 changed files with 5 additions and 3 deletions

View File

@ -549,7 +549,7 @@ General options:
"""
writeResult = []
result = {}
tmpHostIpName = "./tmp_hostsiphostname_%d" % os.getpid()
tmpHostIpName = "./tmp_hostsiphostname_%d_%s" % (os.getpid(), ip)
username = pwd.getpwuid(os.getuid()).pw_name
global ipHostInfo
try:
@ -586,8 +586,9 @@ General options:
hostname = info.split(" ")[0]
if hostname not in ipHosts:
tmpIpHostInfo += info + "\n"
ipHostInfo = tmpIpHostInfo
cmd = "echo '%s' >> /etc/hosts" % (ipHostInfo)
cmd = "echo '%s' >> /etc/hosts" % tmpIpHostInfo
else:
cmd = "echo '%s' >> /etc/hosts" % ipHostInfo
channel = ssh.open_session()
channel.exec_command(cmd)
errInfo = channel.recv_stderr(9999).decode().strip()

View File

@ -303,6 +303,7 @@ class TaskPool(object):
while self.tasks or self.running_tasks:
self.__get_writing_task()
self.__start_limit_task()
time.sleep(0.05)
# Waiting for writing files complete.
for writer in self.writers: