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

b/kamaki/cli/commands/pithos.py
37 37

  
38 38
from kamaki.cli import command
39 39
from kamaki.cli.command_tree import CommandTree
40
from kamaki.cli.errors import raiseCLIError, CLISyntaxError
40
from kamaki.cli.errors import raiseCLIError, CLISyntaxError, CLIBaseUrlError
41 41
from kamaki.cli.utils import (
42 42
    format_size, to_bytes, print_dict, print_items, pretty_keys, pretty_dict,
43 43
    page_hold, bold, ask_user, get_path_size, print_json)
......
147 147
    @staticmethod
148 148
    def _is_dir(remote_dict):
149 149
        return 'application/directory' == remote_dict.get(
150
            'content_type',
151
            remote_dict.get('content-type', ''))
150
            'content_type', remote_dict.get('content-type', ''))
152 151

  
153 152
    @errors.generic.all
154 153
    def _run(self):
155 154
        self.token = self.config.get('file', 'token')\
156 155
            or self.config.get('global', 'token')
157
        pithos_endpoints = self.auth_base.get_service_endpoints(
158
            self.config.get('pithos', 'type'),
159
            self.config.get('pithos', 'version'))
160
        self.base_url = pithos_endpoints['publicURL']
156

  
157
        if getattr(self, 'auth_base', False):
158
            pithos_endpoints = self.auth_base.get_service_endpoints(
159
                self.config.get('pithos', 'type'),
160
                self.config.get('pithos', 'version'))
161
            self.base_url = pithos_endpoints['publicURL']
162
        else:
163
            self.base_url = self.config.get('pithos', 'url')
164
        if not self.base_url:
165
            raise CLIBaseUrlError(service='pithos')
166

  
161 167
        self._set_account()
162 168
        self.container = self.config.get('file', 'container')\
163 169
            or self.config.get('global', 'container')

Also available in: Unified diff