diff --git a/confluent_osdeploy/suse15/profiles/hpc/scripts/syncfileclient b/confluent_osdeploy/suse15/profiles/hpc/scripts/syncfileclient index dd22d6b3..08c9cfdf 100644 --- a/confluent_osdeploy/suse15/profiles/hpc/scripts/syncfileclient +++ b/confluent_osdeploy/suse15/profiles/hpc/scripts/syncfileclient @@ -25,7 +25,7 @@ def partitionhostsline(line): names = names.split() return ipaddr, names, comment -class HostMerger: +class HostMerger(object): def __init__(self): self.byip = {} self.byname = {} @@ -75,8 +75,12 @@ class HostMerger: def write_out(self, targetfile): while not self.targlines[-1]: self.targlines = self.targlines[:-1] + if not self.targlines: + break while not self.sourcelines[-1]: self.sourcelines = self.sourcelines[:-1] + if not self.sourcelines: + break with open(targetfile, 'w') as hosts: for line in self.targlines: hosts.write(line + '\n')