Commit 0663d8d6 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Nice instructions for astakos_cli

parent 2703cceb
......@@ -32,7 +32,7 @@
# or implied, of GRNET S.A.command
from kamaki.cli import command
from kamaki.clients.astakos import AstakosClient
from kamaki.clients.astakos import AstakosClient, ClientError
from kamaki.cli.utils import print_dict
from kamaki.cli.errors import raiseCLIError
from kamaki.cli.commands import _command_init
......@@ -55,12 +55,25 @@ class _astakos_init(_command_init):
@command(astakos_cmds)
class astakos_authenticate(_astakos_init):
"""Authenticate a user"""
"""Authenticate a user
Get user information (e.g. unique account name) from token
Token should be set in settings:
* check if a token is set /config get token
* permanently set a token /config set token <token>
Token can also be provided as a parameter
"""
def main(self, custom_token=None):
super(self.__class__, self).main()
try:
reply = self.client.authenticate(custom_token)
except ClientError as ce:
if (ce.status == 401):
raiseCLIError(ce,
details=['See if token is set: /config get token',
'If not, set a token:',
' 1.(permanent): /config set token <token>',
' 2.(temporary): rerun with <token> parameter'])
except Exception as err:
raiseCLIError(err)
print_dict(reply)
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