Merge "Ansible launcher: re-register functions after disconnect"

This commit is contained in:
Jenkins 2016-08-31 23:21:17 +00:00 committed by Gerrit Code Review
commit 80fe50f484
1 changed files with 6 additions and 1 deletions

View File

@ -68,11 +68,16 @@ class NodeGearWorker(gear.Worker):
MASS_DO = 101
def sendMassDo(self, functions):
data = b'\x00'.join([gear.convert_to_bytes(x) for x in functions])
names = [gear.convert_to_bytes(x) for x in functions]
data = b'\x00'.join(names)
new_function_dict = {}
for name in names:
new_function_dict[name] = gear.FunctionRecord(name)
self.broadcast_lock.acquire()
try:
p = gear.Packet(gear.constants.REQ, self.MASS_DO, data)
self.broadcast(p)
self.functions = new_function_dict
finally:
self.broadcast_lock.release()