2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 01:22:00 +00:00

Fix inconsistent handling of marginal id in syncfileclient

Also, resynchronize syncfileclient across the distributions.
This commit is contained in:
Jarrod Johnson 2021-10-07 12:36:52 -04:00
parent 26c6f1407b
commit 3b7e7afc24
6 changed files with 54 additions and 18 deletions

View File

@ -31,7 +31,7 @@ def partitionhostsline(line):
names = names.split()
return ipaddr, names, comment
class HostMerger:
class HostMerger(object):
def __init__(self):
self.byip = {}
self.byname = {}
@ -81,8 +81,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')
@ -135,12 +139,14 @@ class CredMerger:
except ValueError:
continue
if targfile:
if uid <= minid or uid >= maxid:
if uid < minid or uid > maxid:
self.targdata.append(line)
else:
self.discardnames[name] = 1
else:
if uid >= minid and uid <= maxid:
if name[0] in ('+', '#', '@'):
self.sourcedata.append(line)
elif uid >= minid and uid <= maxid:
self.sourcedata.append(line)
def read_shadow(self, source):
@ -173,6 +179,8 @@ class CredMerger:
shadout.write(line + '\n')
for line in self.sourcedata:
name, _ = line.split(':', 1)
if name[0] in ('+', '#', '@'):
continue
if name in self.shadowednames:
continue
shadout.write(name + ':!:::::::\n')

View File

@ -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')
@ -129,7 +133,7 @@ class CredMerger:
except ValueError:
continue
if targfile:
if uid <= minid or uid >= maxid:
if uid < minid or uid > maxid:
self.targdata.append(line)
else:
self.discardnames[name] = 1

View File

@ -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')
@ -129,7 +133,7 @@ class CredMerger:
except ValueError:
continue
if targfile:
if uid <= minid or uid >= maxid:
if uid < minid or uid > maxid:
self.targdata.append(line)
else:
self.discardnames[name] = 1

View File

@ -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')
@ -129,12 +133,14 @@ class CredMerger:
except ValueError:
continue
if targfile:
if uid <= minid or uid >= maxid:
if uid < minid or uid > maxid:
self.targdata.append(line)
else:
self.discardnames[name] = 1
else:
if uid >= minid and uid <= maxid:
if name[0] in ('+', '#', '@'):
self.sourcedata.append(line)
elif uid >= minid and uid <= maxid:
self.sourcedata.append(line)
def read_shadow(self, source):
@ -167,6 +173,8 @@ class CredMerger:
shadout.write(line + '\n')
for line in self.sourcedata:
name, _ = line.split(':', 1)
if name[0] in ('+', '#', '@'):
continue
if name in self.shadowednames:
continue
shadout.write(name + ':!:::::::\n')
@ -216,4 +224,4 @@ def synchronize():
if __name__ == '__main__':
synchronize()
synchronize()

View File

@ -133,12 +133,14 @@ class CredMerger:
except ValueError:
continue
if targfile:
if uid <= minid or uid >= maxid:
if uid < minid or uid > maxid:
self.targdata.append(line)
else:
self.discardnames[name] = 1
else:
if uid >= minid and uid <= maxid:
if name[0] in ('+', '#', '@'):
self.sourcedata.append(line)
elif uid >= minid and uid <= maxid:
self.sourcedata.append(line)
def read_shadow(self, source):
@ -171,6 +173,8 @@ class CredMerger:
shadout.write(line + '\n')
for line in self.sourcedata:
name, _ = line.split(':', 1)
if name[0] in ('+', '#', '@'):
continue
if name in self.shadowednames:
continue
shadout.write(name + ':!:::::::\n')
@ -220,4 +224,4 @@ def synchronize():
if __name__ == '__main__':
synchronize()
synchronize()

View File

@ -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')
@ -129,12 +133,14 @@ class CredMerger:
except ValueError:
continue
if targfile:
if uid <= minid or uid >= maxid:
if uid < minid or uid > maxid:
self.targdata.append(line)
else:
self.discardnames[name] = 1
else:
if uid >= minid and uid <= maxid:
if name[0] in ('+', '#', '@'):
self.sourcedata.append(line)
elif uid >= minid and uid <= maxid:
self.sourcedata.append(line)
def read_shadow(self, source):
@ -167,6 +173,8 @@ class CredMerger:
shadout.write(line + '\n')
for line in self.sourcedata:
name, _ = line.split(':', 1)
if name[0] in ('+', '#', '@'):
continue
if name in self.shadowednames:
continue
shadout.write(name + ':!:::::::\n')
@ -216,4 +224,4 @@ def synchronize():
if __name__ == '__main__':
synchronize()
synchronize()