Revision 9d3cd179

b/kamaki/cli/commands/pithos.py
1100 1100
                        print('%s is not a regular file' % fpath)
1101 1101
        else:
1102 1102
            if not path.isfile(lpath):
1103
                raiseCLIError(('%s is not  aregular file' % lpath) if (
1103
                raiseCLIError(('%s is not a regular file' % lpath) if (
1104 1104
                    path.exists(lpath)) else '%s does not exist' % lpath)
1105 1105
            try:
1106 1106
                robj = self.client.get_object_info(rpath)
......
2047 2047
    @errors.pithos.connection
2048 2048
    def _run(self):
2049 2049
        accounts = self.client.get_sharing_accounts(marker=self['marker'])
2050
        uuids = [acc['name'] for acc in accounts]
2051
        try:
2052
            astakos_responce = self.auth_base.post_user_catalogs(uuids)
2053
            usernames = astakos_responce.json
2054
            r = usernames['uuid_catalog']
2055
        except Exception as e:
2056
            print 'WARNING: failed to call user_catalogs, %s' % e
2057
            r = dict(sharer_uuid=uuids)
2058
            usernames = accounts
2050 2059
        if self['json_output'] or self['detail']:
2051
            self._print(accounts)
2060
            self._print(usernames)
2052 2061
        else:
2053
            self._print([acc['name'] for acc in accounts])
2062
            self._print(r, print_dict)
2054 2063

  
2055 2064
    def main(self):
2056 2065
        super(self.__class__, self)._run()
b/kamaki/cli/commands/snf-astakos.py
140 140
            self._print(self.client.get_username(self.token, uuids[0]))
141 141
        else:
142 142
            self._print(
143
                self.client.get_username(self.token, uuids), print_dict)
143
                self.client.get_usernames(self.token, uuids), print_dict)
144 144

  
145 145
    def main(self, uuid, *more_uuids):
146 146
        super(self.__class__, self)._run()
b/kamaki/clients/astakos/__init__.py
31 31
# interpreted as representing official policies, either expressed
32 32
# or implied, of GRNET S.A.
33 33

  
34
from kamaki.clients import Client, ClientError
35 34
from logging import getLogger
35
from json import dumps
36

  
37
from kamaki.clients import Client, ClientError
38
from kamaki.clients.utils import path4url
36 39

  
37 40

  
38 41
class AstakosClient(Client):
......
151 154
    def user_term(self, key, token=None):
152 155
        """Get (cached) term, from user credentials"""
153 156
        return self.user_info(token).get(key, None)
157

  
158
    def post_user_catalogs(self, uuids):
159
        """POST base_url/user_catalogs
160

  
161
        :param uuids: (list or tuple) user uuids
162

  
163
        :returns: (dict) {uuid1: name1, uuid2: name2, ...}
164
        """
165
        account_url = self.get_service_endpoints('account')['publicURL']
166
        account = AstakosClient(account_url, self.token)
167
        json_data = dict(uuids=uuids)
168
        return account.post('user_catalogs', json=json_data)

Also available in: Unified diff