forked from CMS/memberPlumbing
Only write out hash if doorUpdater gets to the end of main
This commit is contained in:
parent
a22de02d3e
commit
82e9a9b037
@ -77,10 +77,8 @@ def getMembershipworksData():
|
||||
if newHash == f.read():
|
||||
print("hashes are the same, not updating")
|
||||
sys.exit(0)
|
||||
with open('/tmp/doorUpdaterLastHash', 'w') as f:
|
||||
f.write(newHash)
|
||||
|
||||
return r.text
|
||||
return r.text, newHash
|
||||
|
||||
def makeMember(member, doorAuth):
|
||||
"""Create an output CSV row for the member"""
|
||||
@ -149,12 +147,16 @@ def makeDoor(doorName, doorIPs, members):
|
||||
pass
|
||||
|
||||
def main():
|
||||
data = getMembershipworksData()
|
||||
data, newHash = getMembershipworksData()
|
||||
reader = csv.DictReader(StringIO(data))
|
||||
members = list(reader)
|
||||
|
||||
for doorName, doorIP in doors.items():
|
||||
makeDoor(doorName, doorIP, members)
|
||||
|
||||
# write out hash if we sucessfully got here
|
||||
with open('/tmp/doorUpdaterLastHash', 'w') as f:
|
||||
f.write(newHash)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user