Revision 4018326d

b/kamaki/cli/commands/astakos_cli.py
37 37
from kamaki.cli.commands import _command_init, errors
38 38
from kamaki.cli.command_tree import CommandTree
39 39

  
40
astakos_cmds = CommandTree('astakos', 'Astakos API commands')
41
_commands = [astakos_cmds]
40
user_cmds = CommandTree('user', 'Astakos API commands')
41
_commands = [user_cmds]
42 42

  
43 43

  
44
class _astakos_init(_command_init):
44
class _user_init(_command_init):
45 45

  
46 46
    @errors.generic.all
47
    @errors.astakos.load
47
    @errors.user.load
48 48
    def _run(self):
49
        token = self.config.get('astakos', 'token')\
49
        token = self.config.get('user', 'token')\
50 50
            or self.config.get('global', 'token')
51
        base_url = self.config.get('astakos', 'url')\
51
        base_url = self.config.get('user', 'url')\
52 52
            or self.config.get('global', 'url')
53 53
        self.client = AstakosClient(base_url=base_url, token=token)
54 54
        self._set_log_params()
......
58 58
        self._run()
59 59

  
60 60

  
61
@command(astakos_cmds)
62
class astakos_authenticate(_astakos_init):
61
@command(user_cmds)
62
class user_authenticate(_user_init):
63 63
    """Authenticate a user
64 64
    Get user information (e.g. unique account name) from token
65 65
    Token should be set in settings:
......
69 69
    """
70 70

  
71 71
    @errors.generic.all
72
    @errors.astakos.authenticate
72
    @errors.user.authenticate
73 73
    def _run(self, custom_token=None):
74 74
        super(self.__class__, self)._run()
75 75
        reply = self.client.authenticate(custom_token)
b/kamaki/cli/commands/cyclades_cli.py
51 51

  
52 52

  
53 53
about_authentication = '\nUser Authentication:\
54
    \n* to check authentication: /astakos authenticate\
54
    \n* to check authentication: /user authenticate\
55 55
    \n* to set authentication token: /config set token <token>'
56 56

  
57 57
howto_personality = [
b/kamaki/cli/commands/errors.py
69 69
                if ce.status == 401:
70 70
                    raiseCLIError(ce, 'Authorization failed', details=[
71 71
                        'Make sure a valid token is provided:',
72
                        '  to check if token is valid: /astakos authenticate',
72
                        '  to check if token is valid: /user authenticate',
73 73
                        '  to set token: /config set [.server.]token <token>',
74 74
                        '  to get current token: /config get [server.]token'])
75 75
                elif ce.status in range(-12, 200) + [302, 401, 403, 500]:
......
91 91
        return _raise
92 92

  
93 93

  
94
class astakos(object):
94
class user(object):
95 95

  
96 96
    _token_details = [
97 97
        'To check default token: /config get token',
......
113 113
            if not getattr(client, 'base_url', False):
114 114
                msg = 'Missing astakos server URL'
115 115
                raise CLIError(msg, importance=3, details=[
116
                    'Check if astakos.url is set correctly',
117
                    'To get astakos url:   /config get astakos.url',
118
                    'To set astakos url:   /config set astakos.url <URL>'])
116
                    'Check if user.url is set correctly',
117
                    'To get astakos url:   /config get user.url',
118
                    'To set astakos url:   /config set user.url <URL>'])
119 119
            return r
120 120
        return _raise
121 121

  
b/kamaki/cli/commands/pithos_cli.py
180 180
        self._run()
181 181

  
182 182
    def _set_account(self):
183
        astakos = AstakosClient(self.config.get('astakos', 'url'), self.token)
184
        self.account = self['account'] or astakos.term('uuid')
183
        user = AstakosClient(self.config.get('user', 'url'), self.token)
184
        self.account = self['account'] or user.term('uuid')
185 185

  
186 186
        """Backwards compatibility"""
187 187
        self.account = self.account\
b/kamaki/cli/config.py
90 90
        'cli': 'image_cli',
91 91
        'url': 'https://cyclades.okeanos.grnet.gr/plankton'
92 92
    },
93
    'astakos': {
93
    'user': {
94 94
        'cli': 'astakos_cli',
95 95
        'url': 'https://accounts.okeanos.grnet.gr'
96 96
    }
b/kamaki/clients/livetest/astakos.py
38 38
class Astakos(livetest.Generic):
39 39
    def setUp(self):
40 40
        self.client = AstakosClient(
41
            self['astakos', 'url'],
42
            self['astakos', 'token'])
41
            self['user', 'url'],
42
            self['user', 'token'])
43 43

  
44 44
    def test_authenticate(self):
45 45
        self._test_0010_authenticate()
b/kamaki/clients/livetest/pithos.py
73 73
            self['store', 'url'],
74 74
            self['store', 'token'],
75 75
            AstakosClient(
76
                self['astakos', 'url'],
76
                self['user', 'url'],
77 77
                self['store', 'token']
78 78
            ).term('uuid'))
79 79

  

Also available in: Unified diff