mirror of
https://github.com/xcat2/confluent.git
synced 2025-02-16 18:49:04 +00:00
Defer disarm until after successful client notification
It is theoretically possible for a client to get disconnected right in the middle. In such a scenario, err on the side of letting the mechanism stay armed for the sake of a retry being possible.
This commit is contained in:
parent
34804b2d5f
commit
a4e152c17d
@ -127,14 +127,15 @@ class CredServer(object):
|
||||
if hmacval != hmac.new(hmackey, etok, hashlib.sha256).digest():
|
||||
client.close()
|
||||
return
|
||||
cfgupdate = {nodename: {'crypted.selfapikey': {'hashvalue': echotoken}, 'deployment.sealedapikey': '', 'deployment.apiarmed': ''}}
|
||||
if hmackey and apiarmed != 'continuous':
|
||||
self.cfm.clear_node_attributes([nodename], ['secret.selfapiarmtoken'])
|
||||
if apiarmed == 'continuous':
|
||||
del cfgupdate[nodename]['deployment.apiarmed']
|
||||
cfgupdate = {nodename: {'crypted.selfapikey': {'hashvalue': echotoken}}}
|
||||
self.cfm.set_node_attributes(cfgupdate)
|
||||
client.recv(2) # drain end of message
|
||||
client.send(b'\x05\x00') # report success
|
||||
if hmackey and apiarmed != 'continuous':
|
||||
self.cfm.clear_node_attributes([nodename], ['secret.selfapiarmtoken'])
|
||||
if apiarmed != 'continuous':
|
||||
tokclear = {nodename: {'deployment.sealedapikey': '', 'deployment.apiarmed': ''}}
|
||||
self.cfm.set_node_attributes(tokclear)
|
||||
finally:
|
||||
client.close()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user