Commit 4018326d authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Rename command group astakos to user

The client is still called 'astakos', but the command group is now 'user'

Feature #3566
parent e9ac514e
......@@ -37,18 +37,18 @@ from kamaki.cli.utils import print_dict
from kamaki.cli.commands import _command_init, errors
from kamaki.cli.command_tree import CommandTree
astakos_cmds = CommandTree('astakos', 'Astakos API commands')
_commands = [astakos_cmds]
user_cmds = CommandTree('user', 'Astakos API commands')
_commands = [user_cmds]
class _astakos_init(_command_init):
class _user_init(_command_init):
@errors.generic.all
@errors.astakos.load
@errors.user.load
def _run(self):
token = self.config.get('astakos', 'token')\
token = self.config.get('user', 'token')\
or self.config.get('global', 'token')
base_url = self.config.get('astakos', 'url')\
base_url = self.config.get('user', 'url')\
or self.config.get('global', 'url')
self.client = AstakosClient(base_url=base_url, token=token)
self._set_log_params()
......@@ -58,8 +58,8 @@ class _astakos_init(_command_init):
self._run()
@command(astakos_cmds)
class astakos_authenticate(_astakos_init):
@command(user_cmds)
class user_authenticate(_user_init):
"""Authenticate a user
Get user information (e.g. unique account name) from token
Token should be set in settings:
......@@ -69,7 +69,7 @@ class astakos_authenticate(_astakos_init):
"""
@errors.generic.all
@errors.astakos.authenticate
@errors.user.authenticate
def _run(self, custom_token=None):
super(self.__class__, self)._run()
reply = self.client.authenticate(custom_token)
......
......@@ -51,7 +51,7 @@ _commands = [server_cmds, flavor_cmds, network_cmds]
about_authentication = '\nUser Authentication:\
\n* to check authentication: /astakos authenticate\
\n* to check authentication: /user authenticate\
\n* to set authentication token: /config set token <token>'
howto_personality = [
......
......@@ -69,7 +69,7 @@ class generic(object):
if ce.status == 401:
raiseCLIError(ce, 'Authorization failed', details=[
'Make sure a valid token is provided:',
' to check if token is valid: /astakos authenticate',
' to check if token is valid: /user authenticate',
' to set token: /config set [.server.]token <token>',
' to get current token: /config get [server.]token'])
elif ce.status in range(-12, 200) + [302, 401, 403, 500]:
......@@ -91,7 +91,7 @@ class generic(object):
return _raise
class astakos(object):
class user(object):
_token_details = [
'To check default token: /config get token',
......@@ -113,9 +113,9 @@ class astakos(object):
if not getattr(client, 'base_url', False):
msg = 'Missing astakos server URL'
raise CLIError(msg, importance=3, details=[
'Check if astakos.url is set correctly',
'To get astakos url: /config get astakos.url',
'To set astakos url: /config set astakos.url <URL>'])
'Check if user.url is set correctly',
'To get astakos url: /config get user.url',
'To set astakos url: /config set user.url <URL>'])
return r
return _raise
......
......@@ -180,8 +180,8 @@ class _pithos_init(_command_init):
self._run()
def _set_account(self):
astakos = AstakosClient(self.config.get('astakos', 'url'), self.token)
self.account = self['account'] or astakos.term('uuid')
user = AstakosClient(self.config.get('user', 'url'), self.token)
self.account = self['account'] or user.term('uuid')
"""Backwards compatibility"""
self.account = self.account\
......
......@@ -90,7 +90,7 @@ DEFAULTS = {
'cli': 'image_cli',
'url': 'https://cyclades.okeanos.grnet.gr/plankton'
},
'astakos': {
'user': {
'cli': 'astakos_cli',
'url': 'https://accounts.okeanos.grnet.gr'
}
......
......@@ -38,8 +38,8 @@ from kamaki.clients.astakos import AstakosClient
class Astakos(livetest.Generic):
def setUp(self):
self.client = AstakosClient(
self['astakos', 'url'],
self['astakos', 'token'])
self['user', 'url'],
self['user', 'token'])
def test_authenticate(self):
self._test_0010_authenticate()
......
......@@ -73,7 +73,7 @@ class Pithos(livetest.Generic):
self['store', 'url'],
self['store', 'token'],
AstakosClient(
self['astakos', 'url'],
self['user', 'url'],
self['store', 'token']
).term('uuid'))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment