2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 19:10:10 +00:00

Only close datfile if datfile is a file

If going by filename alone, there will be
no file handle to close. Correct by not
attempting a close in such a case.
This commit is contained in:
Jarrod Johnson 2021-04-22 13:55:10 -04:00
parent b7af6b5c27
commit 8397c5defc
2 changed files with 4 additions and 2 deletions

View File

@ -1539,7 +1539,8 @@ class IpmiHandler(object):
try:
self.ipmicmd.apply_license(filename, data=datfile)
finally:
datfile.close()
if datfile is not None:
datfile.close()
if len(self.element) == 3:
self.output.put(msg.ChildCollection('all'))
i = 1

View File

@ -1384,7 +1384,8 @@ class IpmiHandler(object):
try:
self.ipmicmd.apply_license(filename, data=datfile)
finally:
datfile.close()
if datfile is not None:
datfile.close()
if len(self.element) == 3:
self.output.put(msg.ChildCollection('all'))
i = 1