Skip to content

Commit

Permalink
Fixed getxattr
Browse files Browse the repository at this point in the history
  • Loading branch information
glpatcern committed Nov 26, 2021
1 parent 114beb9 commit be765cb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/xrootiface.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,12 @@ def setxattr(endpoint, filepath, userid, key, value):

def getxattr(endpoint, filepath, userid, key):
'''Get the extended attribute <key> via a special open on behalf of the given userid'''
res = _xrootcmd(endpoint, 'attr', 'get', userid, 'mgm.attr.key=user.' + key + '&mgm.path=' + _getfilepath(filepath, encodeamp=True))
# if no error, the response comes in the format <key>="<value>"
try:
res = _xrootcmd(endpoint, 'attr', 'get', userid, 'mgm.attr.key=user.' + key + '&mgm.path=' + _getfilepath(filepath, encodeamp=True))
# if no error, the response comes in the format <key>="<value>"
return res.split('"')[1]
except IndexError:
log.warning('msg="Failed to getxattr" filepath="%s" key="%s" res="%s"' % (filepath, key, res))
except (IndexError, IOError) as e:
log.warning('msg="Failed to getxattr" filepath="%s" key="%s" res="%s" error="%s"' % (filepath, key, res, e))
return None


Expand Down

0 comments on commit be765cb

Please sign in to comment.