Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
8f80bf81
Commit
8f80bf81
authored
Feb 14, 2013
by
Stratos Psomadakis
Committed by
Christos Stavrakakis
Feb 14, 2013
Browse files
Move exception handling in get_user()
parent
330f8e66
Changes
2
Hide whitespace changes
Inline
Side-by-side
snf-cyclades-app/synnefo/api/management/commands/server-list.py
View file @
8f80bf81
...
...
@@ -132,10 +132,7 @@ class Command(BaseCommand):
user
=
server
.
userid
if
not
options
[
'use_uuids'
]:
try
:
user
=
ucache
.
get_user
(
server
.
userid
)
except
:
pass
user
=
ucache
.
get_user
(
server
.
userid
)
fields
=
(
str
(
server
.
id
),
name
,
user
,
flavor
,
image
,
state
,
str
(
server
.
backend
))
...
...
snf-cyclades-app/synnefo/management/common.py
View file @
8f80bf81
...
...
@@ -263,15 +263,26 @@ def pprint_table(out, table, headers=None, separator=None):
class
UUIDCache
(
object
):
"""UUUID-to-email cache
"""
astakos_url
=
ASTAKOS_URL
.
replace
(
"im/authenticate"
,
"service/api/user_catalogs"
)
def
__init__
(
self
):
self
.
users
=
{}
def
get_user
(
self
,
uuid
):
"""Do the uuid-to-email resolving
"""
if
not
uuid
in
self
.
users
:
astakos_url
=
ASTAKOS_URL
.
replace
(
"im/authenticate"
,
"service/api/user_catalogs"
)
self
.
users
[
uuid
]
=
\
astakos
.
get_displayname
(
token
=
CYCLADES_ASTAKOS_SERVICE_TOKEN
,
url
=
astakos_url
,
uuid
=
uuid
)
try
:
self
.
users
[
uuid
]
=
\
astakos
.
get_displayname
(
token
=
CYCLADES_ASTAKOS_SERVICE_TOKEN
,
url
=
UUIDCache
.
astakos_url
,
uuid
=
uuid
)
except
Exception
:
return
uuid
return
self
.
users
[
uuid
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment