Revision 8df4fae6 snf-pithos-app/pithos/api/util.py
b/snf-pithos-app/pithos/api/util.py | ||
---|---|---|
59 | 59 |
QUOTAHOLDER_POOLSIZE, |
60 | 60 |
BACKEND_QUOTA, BACKEND_VERSIONING, |
61 | 61 |
BACKEND_FREE_VERSIONING, |
62 |
AUTHENTICATION_URL, AUTHENTICATION_USERS,
|
|
62 |
AUTHENTICATION_URL, |
|
63 | 63 |
COOKIE_NAME, USER_CATALOG_URL, |
64 | 64 |
RADOS_STORAGE, RADOS_POOL_BLOCKS, |
65 | 65 |
RADOS_POOL_MAPS, TRANSLATE_UUIDS, |
... | ... | |
274 | 274 |
########################## |
275 | 275 |
|
276 | 276 |
def retrieve_displayname(token, uuid, fail_silently=True): |
277 |
displayname = get_displayname( |
|
278 |
token, uuid, USER_CATALOG_URL, AUTHENTICATION_USERS) |
|
277 |
displayname = get_displayname(token, uuid, USER_CATALOG_URL) |
|
279 | 278 |
if not displayname and not fail_silently: |
280 | 279 |
raise ItemNotExists(uuid) |
281 | 280 |
elif not displayname: |
... | ... | |
284 | 283 |
return displayname |
285 | 284 |
|
286 | 285 |
def retrieve_displaynames(token, uuids, return_dict=False, fail_silently=True): |
287 |
catalog = get_displaynames( |
|
288 |
token, uuids, USER_CATALOG_URL, AUTHENTICATION_USERS) or {} |
|
286 |
catalog = get_displaynames(token, uuids, USER_CATALOG_URL) or {} |
|
289 | 287 |
missing = list(set(uuids) - set(catalog)) |
290 | 288 |
if missing and not fail_silently: |
291 | 289 |
raise ItemNotExists('Unknown displaynames: %s' % ', '.join(missing)) |
... | ... | |
295 | 293 |
if is_uuid(displayname): |
296 | 294 |
return displayname |
297 | 295 |
|
298 |
uuid = get_user_uuid( |
|
299 |
token, displayname, USER_CATALOG_URL, AUTHENTICATION_USERS) |
|
296 |
uuid = get_user_uuid(token, displayname, USER_CATALOG_URL) |
|
300 | 297 |
if not uuid: |
301 | 298 |
raise ItemNotExists(displayname) |
302 | 299 |
return uuid |
303 | 300 |
|
304 | 301 |
def retrieve_uuids(token, displaynames, return_dict=False, fail_silently=True): |
305 |
catalog = get_uuids( |
|
306 |
token, displaynames, USER_CATALOG_URL, AUTHENTICATION_USERS) or {} |
|
302 |
catalog = get_uuids(token, displaynames, USER_CATALOG_URL) or {} |
|
307 | 303 |
missing = list(set(displaynames) - set(catalog)) |
308 | 304 |
if missing and not fail_silently: |
309 | 305 |
raise ItemNotExists('Unknown uuids: %s' % ', '.join(missing)) |
... | ... | |
1007 | 1003 |
|
1008 | 1004 |
def get_pithos_usage(token): |
1009 | 1005 |
"""Get Pithos Usage from astakos.""" |
1010 |
user_info = user_for_token(token, AUTHENTICATION_URL, AUTHENTICATION_USERS, |
|
1011 |
usage=True) |
|
1006 |
user_info = user_for_token(token, AUTHENTICATION_URL, usage=True) |
|
1012 | 1007 |
usage = user_info.get("usage", []) |
1013 | 1008 |
for u in usage: |
1014 | 1009 |
if u.get('name') == 'pithos+.diskspace': |
Also available in: Unified diff