2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-04-12 03:41:29 +00:00

Add error mesasges to help with non-root confluent

non-root confluent daemon will have a larger struggle
with permissions, try to help the user navigate that.
This commit is contained in:
Jarrod Johnson
2020-02-03 10:13:26 -05:00
parent 44e6a72847
commit cfae28a869
2 changed files with 28 additions and 6 deletions

View File

@@ -36,14 +36,31 @@ _tracelog = None
def execupdate(handler, filename, updateobj, type, owner, node):
global _tracelog
if type != 'ffdc' and not os.path.exists(filename):
errstr = '{0} does not appear to exist on {1}'.format(
filename, socket.gethostname())
updateobj.handle_progress({'phase': 'error', 'progress': 0.0,
'detail': errstr})
return
if type != 'ffdc:
errstr = False
if not os.path.exists(filename):
errstr = '{0} does not appear to exist on {1}'.format(
filename, socket.gethostname())
elif 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())
if errstr:
updateobj.handle_progress({'phase': 'error', 'progress': 0.0,
'detail': errstr})
return
if type == 'ffdc' and os.path.isdir(filename):
filename += '/' + node
if 'type' == 'ffdc':
errstr = False
if os.path.exists(filename):
errstr = '{0} already exists on {1}, cannot overwrite'.format(
filename, socket.gethostname())
elif not os.access(os.path.dirname(filename), os.W_OK):
errstr = '{0} directory not writable by confluent user/group on {1}, check the directory and parent directory ownership and permissions'.format(filename, socket.gethostname())
if errstr:
updateobj.handle_progress({'phase': 'error', 'progress': 0.0,
'detail': errstr})
return
try:
if type == 'firmware':
completion = handler(filename, progress=updateobj.handle_progress,

View File

@@ -1494,6 +1494,11 @@ class IpmiHandler(object):
def save_licenses(self):
directory = self.inputdata.nodefile(self.node)
if not os.access(os.path.dirname(directory), os.W_OK):
raise exc.InvalidArgumentException(
'The onfluent system user/group is unable to write to '
'directory {0}, check ownership and permissions'.format(
os.path.dirname(directory)))
for saved in self.ipmicmd.save_licenses(directory):
self.output.put(msg.SavedFile(self.node, saved))