Revision 8cec3671 kamaki/cli/commands/image.py

b/kamaki/cli/commands/image.py
45 45
from kamaki.cli.argument import FlagArgument, ValueArgument, KeyValueArgument
46 46
from kamaki.cli.argument import IntArgument
47 47
from kamaki.cli.commands.cyclades import _init_cyclades
48
from kamaki.cli.errors import raiseCLIError
48
from kamaki.cli.errors import raiseCLIError, CLIBaseUrlError
49 49
from kamaki.cli.commands import _command_init, errors
50 50
from kamaki.cli.commands import _optional_output_cmd, _optional_json
51 51

  
......
75 75
    @errors.generic.all
76 76
    def _run(self):
77 77
        token = self.config.get('image', 'token')\
78
            or self.config.get('compute', 'token')\
79 78
            or self.config.get('global', 'token')
80
        plankton_endpoints = self.auth_base.get_service_endpoints(
81
            self.config.get('plankton', 'type'),
82
            self.config.get('plankton', 'version'))
83
        base_url = plankton_endpoints['publicURL']
84
        #base_url = self.config.get('image', 'url')\
85
        #    or self.config.get('compute', 'url')\
86
        #    or self.config.get('global', 'url')
79

  
80
        if getattr(self, 'auth_base', False):
81
            plankton_endpoints = self.auth_base.get_service_endpoints(
82
                self.config.get('plankton', 'type'),
83
                self.config.get('plankton', 'version'))
84
            base_url = plankton_endpoints['publicURL']
85
        else:
86
            base_url = self.config.get('plankton', 'url')
87
        if not base_url:
88
            raise CLIBaseUrlError(service='plankton')
89

  
87 90
        self.client = ImageClient(base_url=base_url, token=token)
88 91
        self._set_log_params()
89 92
        self._update_max_threads()

Also available in: Unified diff