mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-25 11:01:09 +00:00
Further clean up license error handling
Backup of nodelicense was not consistently checked between redfish and ipmi plugins.
This commit is contained in:
parent
bf31c4872f
commit
f2bd796c2a
@ -97,8 +97,10 @@ def save_licenses(session, dirname):
|
||||
fname = res['databynode'][node].get('filename', None)
|
||||
if fname:
|
||||
print('{0}: Saved license to {1}'.format(node, fname))
|
||||
elif 'error' in res['databynode'][node]:
|
||||
sys.stderr.write('{0}: {1}\n'.format(node, res['databynode'][node]['error']))
|
||||
else:
|
||||
sys.stderr.write('{0}: {1}'.format(node, repr(res['databynode'][node])))
|
||||
sys.stderr.write('{0}: {1}\n'.format(node, repr(res['databynode'][node])))
|
||||
|
||||
|
||||
def show_licenses(session):
|
||||
|
@ -1494,11 +1494,14 @@ class IpmiHandler(object):
|
||||
|
||||
def save_licenses(self):
|
||||
directory = self.inputdata.nodefile(self.node)
|
||||
if not os.access(os.path.dirname(directory), os.W_OK):
|
||||
checkdir = directory
|
||||
if not os.path.isdir(checkdir):
|
||||
checkdir = os.path.dirname(checkdir)
|
||||
if not os.access(checkdir, os.W_OK):
|
||||
raise exc.InvalidArgumentException(
|
||||
'The onfluent system user/group is unable to write to '
|
||||
'The confluent system user/group is unable to write to '
|
||||
'directory {0}, check ownership and permissions'.format(
|
||||
os.path.dirname(directory)))
|
||||
checkdir))
|
||||
for saved in self.ipmicmd.save_licenses(directory):
|
||||
self.output.put(msg.SavedFile(self.node, saved))
|
||||
|
||||
|
@ -1347,6 +1347,14 @@ class IpmiHandler(object):
|
||||
|
||||
def save_licenses(self):
|
||||
directory = self.inputdata.nodefile(self.node)
|
||||
checkdir = directory
|
||||
if not os.path.isdir(checkdir):
|
||||
checkdir = os.path.dirname(checkdir)
|
||||
if not os.access(checkdir, os.W_OK):
|
||||
raise exc.InvalidArgumentException(
|
||||
'The confluent system user/group is unable to write to '
|
||||
'directory {0}, check ownership and permissions'.format(
|
||||
checkdir))
|
||||
for saved in self.ipmicmd.save_licenses(directory):
|
||||
self.output.put(msg.SavedFile(self.node, saved))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user