2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-28 20:39:40 +00:00

Fix leaking file descriptors

When passing a filehandle for update, clean it up on end
of the update/upload.
This commit is contained in:
Jarrod Johnson 2021-02-26 16:18:58 -05:00
parent 83d92ecfcc
commit 814257fbf8

View File

@ -103,6 +103,7 @@ class Updater(object):
datfile = os.fdopen(os.dup(cf.fileno()), cf.mode)
else:
datfile = None
self.datfile = datfile
self.updateproc = updatepool.spawn(execupdate, handler, filename,
self, type, owner, node, datfile)
if type == 'firmware':
@ -127,6 +128,8 @@ class Updater(object):
def cancel(self):
self.updateproc.kill()
if self.datfile:
self.datfile.close()
@property
def progress(self):