Revision 54b6be76 kamaki/cli/commands/astakos.py
b/kamaki/cli/commands/astakos.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A.command |
33 | 33 |
|
34 | 34 |
from kamaki.cli import command |
35 |
#from kamaki.clients.astakos import AstakosClient
|
|
35 |
from kamaki.clients.astakos import AstakosClient |
|
36 | 36 |
from kamaki.cli.commands import _command_init, errors, _optional_json |
37 | 37 |
from kamaki.cli.command_tree import CommandTree |
38 |
from kamaki.cli.errors import CLIBaseUrlError |
|
38 | 39 |
|
39 | 40 |
user_cmds = CommandTree('user', 'Astakos API commands') |
40 | 41 |
_commands = [user_cmds] |
... | ... | |
49 | 50 |
# or self.config.get('global', 'token') |
50 | 51 |
#base_url = self.config.get('global', 'url') |
51 | 52 |
#self.client = AstakosClient(base_url=base_url, token=token) |
52 |
self.client = self.auth_base |
|
53 |
if getattr(self, 'auth_base', False): |
|
54 |
self.client = self.auth_base |
|
55 |
else: |
|
56 |
token = self.config.get('astakos', 'token')\ |
|
57 |
or self.config.get('global', 'token') |
|
58 |
base_url = self.config.get('astakos', 'url') |
|
59 |
if not base_url: |
|
60 |
raise CLIBaseUrlError(service='astakos') |
|
61 |
self.client = AstakosClient(base_url=base_url, token=token) |
|
62 |
|
|
53 | 63 |
self._set_log_params() |
54 | 64 |
self._update_max_threads() |
55 | 65 |
|
... | ... | |
71 | 81 |
@errors.user.authenticate |
72 | 82 |
def _run(self, custom_token=None): |
73 | 83 |
super(self.__class__, self)._run() |
74 |
r = self.auth_base.authenticate(custom_token)
|
|
84 |
r = self.client.authenticate(custom_token)
|
|
75 | 85 |
self._print([r], title=('uuid', 'name',), with_redundancy=True) |
76 | 86 |
|
77 | 87 |
def main(self, custom_token=None): |
Also available in: Unified diff