Revision f724cd35 kamaki/cli/commands/errors.py
b/kamaki/cli/commands/errors.py | ||
---|---|---|
54 | 54 |
return _raise |
55 | 55 |
|
56 | 56 |
@classmethod |
57 |
def _connection(this, foo, base_url):
|
|
57 |
def _connection(this, foo): |
|
58 | 58 |
def _raise(self, *args, **kwargs): |
59 | 59 |
try: |
60 | 60 |
foo(self, *args, **kwargs) |
... | ... | |
68 | 68 |
' to get current token: /config get [server.]token']) |
69 | 69 |
elif ce.status in range(-12, 200) + [302, 401, 403, 500]: |
70 | 70 |
raiseCLIError(ce, importance=3, details=[ |
71 |
'Check if service is up or set to url %s' % base_url, |
|
72 |
' to get url: /config get %s' % base_url, |
|
73 |
' to set url: /config set %s <URL>' % base_url]) |
|
71 |
'Check if serviceis up']) |
|
74 | 72 |
elif ce.status == 404 and 'kamakihttpresponse' in ce_msg: |
75 | 73 |
client = getattr(self, 'client', None) |
76 | 74 |
if not client: |
... | ... | |
78 | 76 |
url = getattr(client, 'base_url', '<empty>') |
79 | 77 |
msg = 'Invalid service url %s' % url |
80 | 78 |
raiseCLIError(ce, msg, details=[ |
81 |
'Please, check if service url is correctly set',
|
|
82 |
'* to get current url: /config get compute.url',
|
|
83 |
'* to set url: /config set compute.url <URL>'])
|
|
79 |
'Check if authentication url is correct',
|
|
80 |
' check current url: /config get url',
|
|
81 |
' set new auth. url: /config set url'])
|
|
84 | 82 |
raise |
85 | 83 |
return _raise |
86 | 84 |
|
... | ... | |
90 | 88 |
_token_details = [ |
91 | 89 |
'To check default token: /config get token', |
92 | 90 |
'If set/update a token:', |
93 |
'* (permanent): /config set token <token>',
|
|
94 |
'* (temporary): re-run with <token> parameter']
|
|
91 |
'* (permanent): /config set token <token>', |
|
92 |
'* (temporary): re-run with <token> parameter'] |
|
95 | 93 |
|
96 | 94 |
@classmethod |
97 | 95 |
def load(this, foo): |
... | ... | |
105 | 103 |
kloger.warning( |
106 | 104 |
'No permanent token (try: kamaki config set token <tkn>)') |
107 | 105 |
if not getattr(client, 'base_url', False): |
108 |
msg = 'Missing astakos server URL'
|
|
106 |
msg = 'Missing synnefo URL'
|
|
109 | 107 |
raise CLIError(msg, importance=3, details=[ |
110 |
'Check if user.url is set correctly',
|
|
111 |
'To get astakos url: /config get user.url',
|
|
112 |
'To set astakos url: /config set user.url <URL>'])
|
|
108 |
'Check if authentication url is correct',
|
|
109 |
' check current url: /config get url',
|
|
110 |
' set new auth. url: /config set url'])
|
|
113 | 111 |
return r |
114 | 112 |
return _raise |
115 | 113 |
|
... | ... | |
164 | 162 |
|
165 | 163 |
@classmethod |
166 | 164 |
def connection(this, foo): |
167 |
return generic._connection(foo, 'compute.url')
|
|
165 |
return generic._connection(foo) |
|
168 | 166 |
|
169 | 167 |
@classmethod |
170 | 168 |
def date(this, foo): |
... | ... | |
360 | 358 |
|
361 | 359 |
@classmethod |
362 | 360 |
def connection(this, foo): |
363 |
return generic._connection(foo, 'image.url')
|
|
361 |
return generic._connection(foo) |
|
364 | 362 |
|
365 | 363 |
@classmethod |
366 | 364 |
def id(this, foo): |
... | ... | |
408 | 406 |
|
409 | 407 |
@classmethod |
410 | 408 |
def connection(this, foo): |
411 |
return generic._connection(foo, 'file.url')
|
|
409 |
return generic._connection(foo) |
|
412 | 410 |
|
413 | 411 |
@classmethod |
414 | 412 |
def account(this, foo): |
Also available in: Unified diff