2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

license install through passed fd

Allow install of licenses that confluent cannot read.
This commit is contained in:
Jarrod Johnson 2021-02-26 16:37:34 -05:00
parent f34e184d31
commit 008089c4c0
2 changed files with 18 additions and 4 deletions

View File

@ -1525,14 +1525,21 @@ class IpmiHandler(object):
self.element = self.element[:-1]
if self.op in ('create', 'update'):
filename = self.inputdata.nodefile(self.node)
if not os.access(filename, os.R_OK):
datfile = None
if filename in self.cfm.clientfiles:
cf = self.cfm.clientfiles[filename]
datfile = os.fdopen(os.dup(cf.filenoe()), cf.mode)
if datfile is None and not os.access(filename, os.R_OK):
errstr = ('{0} is not readable by confluent on {1} '
'(ensure confluent user or group can access file '
'and parent directories)').format(
filename, socket.gethostname())
self.output.put(msg.ConfluentNodeError(self.node, errstr))
return
self.ipmicmd.apply_license(filename)
try:
self.ipmicmd.apply_license(filename, data=datfile)
finally:
datfile.close()
if len(self.element) == 3:
self.output.put(msg.ChildCollection('all'))
i = 1

View File

@ -1370,14 +1370,21 @@ class IpmiHandler(object):
self.element = self.element[:-1]
if self.op in ('create', 'update'):
filename = self.inputdata.nodefile(self.node)
if not os.access(filename, os.R_OK):
datfile = None
if filename in self.cfm.clientfiles:
cf = self.cfm.clientfiles[filename]
datfile = os.fdopen(os.dup(cf.filenoe()), cf.mode)
if datfile is None and not os.access(filename, os.R_OK):
errstr = ('{0} is not readable by confluent on {1} '
'(ensure confluent user or group can access file '
'and parent directories)').format(
filename, socket.gethostname())
self.output.put(msg.ConfluentNodeError(self.node, errstr))
return
self.ipmicmd.apply_license(self.inputdata.nodefile(self.node))
try:
self.ipmicmd.apply_license(filename, data=datfile)
finally:
datfile.close()
if len(self.element) == 3:
self.output.put(msg.ChildCollection('all'))
i = 1