Revision 54b6be76 kamaki/cli/commands/cyclades.py
b/kamaki/cli/commands/cyclades.py | ||
---|---|---|
34 | 34 |
from kamaki.cli import command |
35 | 35 |
from kamaki.cli.command_tree import CommandTree |
36 | 36 |
from kamaki.cli.utils import print_dict |
37 |
from kamaki.cli.errors import raiseCLIError, CLISyntaxError |
|
37 |
from kamaki.cli.errors import raiseCLIError, CLISyntaxError, CLIBaseUrlError
|
|
38 | 38 |
from kamaki.clients.cyclades import CycladesClient, ClientError |
39 | 39 |
from kamaki.cli.argument import FlagArgument, ValueArgument, KeyValueArgument |
40 | 40 |
from kamaki.cli.argument import ProgressBarArgument, DateArgument, IntArgument |
... | ... | |
70 | 70 |
def _run(self, service='compute'): |
71 | 71 |
token = self.config.get(service, 'token')\ |
72 | 72 |
or self.config.get('global', 'token') |
73 |
cyclades_endpoints = self.auth_base.get_service_endpoints( |
|
74 |
self.config.get('cyclades', 'type'), |
|
75 |
self.config.get('cyclades', 'version')) |
|
76 |
base_url = cyclades_endpoints['publicURL'] |
|
73 |
|
|
74 |
if getattr(self, 'auth_base', False): |
|
75 |
cyclades_endpoints = self.auth_base.get_service_endpoints( |
|
76 |
self.config.get('cyclades', 'type'), |
|
77 |
self.config.get('cyclades', 'version')) |
|
78 |
base_url = cyclades_endpoints['publicURL'] |
|
79 |
else: |
|
80 |
base_url = self.config.get('cyclades', 'url') |
|
81 |
if not base_url: |
|
82 |
raise CLIBaseUrlError(service='cyclades') |
|
83 |
|
|
77 | 84 |
self.client = CycladesClient(base_url=base_url, token=token) |
78 | 85 |
self._set_log_params() |
79 | 86 |
self._update_max_threads() |
Also available in: Unified diff