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
kamaki
Commits
35e82130
Commit
35e82130
authored
Aug 02, 2013
by
Stavros Sachtouris
Browse files
Merge branch 'feature-sharers' into develop
parents
c3e1ac99
72e2176c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Changelog
View file @
35e82130
...
...
@@ -12,6 +12,7 @@ Changes:
info --> user_info, user --> list_users
- Simplify listings (kamaki.cli.utils: print methods)
- Enrich client API docs with examples and astakos endpoint information [#4135]
- Show user names in /file sharers [#4203]
Features:
...
...
@@ -43,4 +44,6 @@ Features:
- Guess mimetype when uploading and use it in upload [#4196]
- Add upload local image abilities to register [#4206]
New register args: --update-image-file=/local/path, --no-progress-bar
- Implement an astakos.post_user_catalogs call for getting usernames from a
list of user uuids [#4203]
kamaki/cli/commands/pithos.py
View file @
35e82130
...
...
@@ -1100,7 +1100,7 @@ class file_upload(_file_container_command, _optional_output_cmd):
print
(
'%s is not a regular file'
%
fpath
)
else
:
if
not
path
.
isfile
(
lpath
):
raiseCLIError
((
'%s is not
aregular file'
%
lpath
)
if
(
raiseCLIError
((
'%s is not a
regular file'
%
lpath
)
if
(
path
.
exists
(
lpath
))
else
'%s does not exist'
%
lpath
)
try
:
robj
=
self
.
client
.
get_object_info
(
rpath
)
...
...
@@ -2047,10 +2047,19 @@ class file_sharers(_file_account_command, _optional_json):
@
errors
.
pithos
.
connection
def
_run
(
self
):
accounts
=
self
.
client
.
get_sharing_accounts
(
marker
=
self
[
'marker'
])
uuids
=
[
acc
[
'name'
]
for
acc
in
accounts
]
try
:
astakos_responce
=
self
.
auth_base
.
post_user_catalogs
(
uuids
)
usernames
=
astakos_responce
.
json
r
=
usernames
[
'uuid_catalog'
]
except
Exception
as
e
:
print
'WARNING: failed to call user_catalogs, %s'
%
e
r
=
dict
(
sharer_uuid
=
uuids
)
usernames
=
accounts
if
self
[
'json_output'
]
or
self
[
'detail'
]:
self
.
_print
(
account
s
)
self
.
_print
(
username
s
)
else
:
self
.
_print
(
[
acc
[
'name'
]
for
acc
in
accounts
]
)
self
.
_print
(
r
,
print_dict
)
def
main
(
self
):
super
(
self
.
__class__
,
self
).
_run
()
...
...
kamaki/cli/commands/snf-astakos.py
View file @
35e82130
...
...
@@ -140,7 +140,7 @@ class astakos_user_name(_astakos_init, _optional_json):
self
.
_print
(
self
.
client
.
get_username
(
self
.
token
,
uuids
[
0
]))
else
:
self
.
_print
(
self
.
client
.
get_username
(
self
.
token
,
uuids
),
print_dict
)
self
.
client
.
get_username
s
(
self
.
token
,
uuids
),
print_dict
)
def
main
(
self
,
uuid
,
*
more_uuids
):
super
(
self
.
__class__
,
self
).
_run
()
...
...
kamaki/clients/astakos/__init__.py
View file @
35e82130
...
...
@@ -31,8 +31,11 @@
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
from
kamaki.clients
import
Client
,
ClientError
from
logging
import
getLogger
from
json
import
dumps
from
kamaki.clients
import
Client
,
ClientError
from
kamaki.clients.utils
import
path4url
class
AstakosClient
(
Client
):
...
...
@@ -151,3 +154,15 @@ class AstakosClient(Client):
def
user_term
(
self
,
key
,
token
=
None
):
"""Get (cached) term, from user credentials"""
return
self
.
user_info
(
token
).
get
(
key
,
None
)
def
post_user_catalogs
(
self
,
uuids
):
"""POST base_url/user_catalogs
:param uuids: (list or tuple) user uuids
:returns: (dict) {uuid1: name1, uuid2: name2, ...}
"""
account_url
=
self
.
get_service_endpoints
(
'account'
)[
'publicURL'
]
account
=
AstakosClient
(
account_url
,
self
.
token
)
json_data
=
dict
(
uuids
=
uuids
)
return
account
.
post
(
'user_catalogs'
,
json
=
json_data
)
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