Revision cb4a5d9c

b/Changelog
4 4

  
5 5
Changes:
6 6

  
7
- Adjust astakos authenticate to the new url shchem of synnefo >= 0.14 [#3832, #3874]
7
- Adjust astakos authenticate to the new url scheme of synnefo >= 0.14 [#3832, #3874]
8 8
  as a side effect, some renamings in astakos.AstakosClient:
9 9
   info --> user_info, user --> list_users
10 10

  
b/kamaki/cli/__init__.py
201 201
    _include = arguments['include'].value
202 202
    global _verbose
203 203
    _verbose = arguments['verbose'].value
204
    _cnf = arguments['config']
204 205
    global _colors
205
    _colors = arguments['config'].get('global', 'colors')
206
    _colors = _cnf.get('global', 'colors')
206 207
    if not (stdout.isatty() and _colors == 'on'):
207 208
        from kamaki.cli.utils import remove_colors
208 209
        remove_colors()
209 210
    _silent = arguments['silent'].value
210 211
    _setup_logging(_silent, _debug, _verbose, _include)
211
    global_url = arguments['config'].get('global', 'url')
212
    global_token = arguments['config'].get('global', 'token')
212
    picked_cloud = arguments['cloud'].value
213
    if picked_cloud:
214
        global_url = _cnf.get('remotes', picked_cloud)
215
        if not global_url:
216
            raise CLIError(
217
                'No remote cloud "%s" in kamaki configuration' % picked_cloud,
218
                importance=3, details=[
219
                    'To check if this remote cloud alias is declared:',
220
                    '  /config get remotes.%s' % picked_cloud,
221
                    'To set a remote authentication URI aliased as "%s"' % (
222
                        picked_cloud),
223
                    '  /config set remotes.%s <URI>' % picked_cloud
224
                ])
225
    else:
226
        global_url = _cnf.get('global', 'auth_url')
227
    global_token = _cnf.get('global', 'token')
213 228
    from kamaki.clients.astakos import AstakosClient as AuthCachedClient
214 229
    return AuthCachedClient(global_url, global_token)
215 230

  
b/kamaki/cli/argument.py
398 398

  
399 399
_arguments = dict(
400 400
    config=_config_arg,
401
    cloud=ValueArgument('Chose a remote cloud to connect to', ('--cloud')),
401 402
    help=Argument(0, 'Show help message', ('-h', '--help')),
402 403
    debug=FlagArgument('Include debug output', ('-d', '--debug')),
403 404
    include=FlagArgument(
404
        'Include raw connection data in the output',
405
        ('-i', '--include')),
405
        'Include raw connection data in the output', ('-i', '--include')),
406 406
    silent=FlagArgument('Do not output anything', ('-s', '--silent')),
407 407
    verbose=FlagArgument('More info at response', ('-v', '--verbose')),
408 408
    version=VersionArgument('Print current version', ('-V', '--version')),
409 409
    options=CmdLineConfigArgument(
410
        _config_arg,
411
        'Override a config value',
412
        ('-o', '--options'))
410
        _config_arg, 'Override a config value', ('-o', '--options'))
413 411
)
414
"""Initial command line interface arguments"""
415

  
416

  
417
"""
418
Mechanism:
419
    init_parser
420
    parse_known_args
421
    manage top-level user arguments input
422
    find user-requested command
423
    add command-specific arguments to dict
424
    update_arguments
425
"""
412

  
413

  
414
#  Initial command line interface arguments
426 415

  
427 416

  
428 417
class ArgumentParseManager(object):
b/kamaki/cli/commands/image.py
81 81
            self.config.get('plankton', 'type'),
82 82
            self.config.get('plankton', 'version'))
83 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')
84
        #base_url = self.config.get('image', 'url')\
85
        #    or self.config.get('compute', 'url')\
86
        #    or self.config.get('global', 'url')
87 87
        self.client = ImageClient(base_url=base_url, token=token)
88 88
        self._set_log_params()
89 89
        self._update_max_threads()
......
303 303

  
304 304
    def _get_uuid(self):
305 305
        atoken = self.client.token
306
        user = AstakosClient(self.config.get('user', 'url'), atoken)
307
        return user.term('uuid')
306
        #user = AstakosClient(self.config.get('user', 'url'), atoken)
307
        #return user.term('uuid')
308
        self.auth_base.term('uuid', atoken)
308 309

  
309 310
    def _get_pithos_client(self, container):
310 311
        if self['no_metafile_upload']:
b/kamaki/clients/astakos/__init__.py
53 53
        :returns: (dict) authentication information
54 54
        """
55 55
        self.token = token or self.token
56
        self._cache[self.token] = self.get('/tokens').json
56
        self._cache[self.token] = self.post('/tokens').json
57 57
        return self._cache[self.token]
58 58

  
59 59
    def get_services(self, token=None):

Also available in: Unified diff