From: Stavros Sachtouris Date: Thu, 27 Jun 2013 11:52:16 +0000 (+0300) Subject: Implement a user_list to list cached shell users X-Git-Tag: debian/0.10-1wheezy~46^2~2 X-Git-Url: https://code.grnet.gr/git/kamaki/commitdiff_plain/9a8861d151526ee1bedc216a39f5b595f9f18e89 Implement a user_list to list cached shell users Refs: #3632 --- diff --git a/kamaki/cli/commands/astakos.py b/kamaki/cli/commands/astakos.py index aed9363..7b7c942 100644 --- a/kamaki/cli/commands/astakos.py +++ b/kamaki/cli/commands/astakos.py @@ -85,7 +85,6 @@ class user_authenticate(_user_init, _optional_json): @errors.generic.all @errors.user.authenticate def _run(self, custom_token=None): - super(self.__class__, self)._run() token_bu = self.client.token try: r = self.client.authenticate(custom_token) @@ -96,4 +95,18 @@ class user_authenticate(_user_init, _optional_json): self._print(r, self._print_access) def main(self, custom_token=None): + super(self.__class__, self)._run() self._run(custom_token) + + +@command(user_cmds) +class user_list(_user_init, _optional_json): + """Get service endpoints""" + + @errors.generic.all + def _run(self, custom_token=None): + self._print(self.client.list_users()) + + def main(self): + super(self.__class__, self)._run() + self._run() diff --git a/kamaki/clients/astakos/__init__.py b/kamaki/clients/astakos/__init__.py index 897eab0..252d584 100644 --- a/kamaki/clients/astakos/__init__.py +++ b/kamaki/clients/astakos/__init__.py @@ -117,6 +117,8 @@ class AstakosClient(Client): def list_users(self): """list cached users information""" + if not self._cache: + self.authenticate() r = [] for k, v in self._cache.items(): r.append(dict(v['access']['user']))