Revision ca5b9261 kamaki/cli/commands/errors.py
b/kamaki/cli/commands/errors.py | ||
---|---|---|
38 | 38 |
from kamaki.cli import _debug, kloger |
39 | 39 |
from kamaki.cli.utils import format_size |
40 | 40 |
|
41 |
CLOUDNAME = [ |
|
42 |
'Note: If you use a named cloud remote, use its name', |
|
43 |
'instead of "default"'] |
|
44 |
|
|
41 | 45 |
|
42 | 46 |
class generic(object): |
43 | 47 |
|
... | ... | |
66 | 70 |
raiseCLIError(ce, 'Authorization failed', details=[ |
67 | 71 |
'Make sure a valid token is provided:', |
68 | 72 |
' to check if token is valid: /user authenticate', |
69 |
' to set token: /config set [.server.]token <token>', |
|
70 |
' to get current token: /config get [server.]token']) |
|
73 |
' to set token:', |
|
74 |
' /config set remote.default.token <token>', |
|
75 |
' to get current token:', |
|
76 |
' /config get remote.default.token'] + CLOUDNAME) |
|
71 | 77 |
elif ce.status in range(-12, 200) + [302, 401, 403, 500]: |
72 | 78 |
raiseCLIError(ce, importance=3, details=[ |
73 | 79 |
'Check if service is up']) |
... | ... | |
79 | 85 |
msg = 'Invalid service url %s' % url |
80 | 86 |
raiseCLIError(ce, msg, details=[ |
81 | 87 |
'Check if authentication url is correct', |
82 |
' check current url: /config get url', |
|
83 |
' set new auth. url: /config set url']) |
|
88 |
' check current url:', |
|
89 |
' /config get remote.default.url', |
|
90 |
' set new auth. url:', |
|
91 |
' /config set remote.default.url'] + CLOUDNAME) |
|
84 | 92 |
raise |
85 | 93 |
return _raise |
86 | 94 |
|
... | ... | |
88 | 96 |
class user(object): |
89 | 97 |
|
90 | 98 |
_token_details = [ |
91 |
'To check default token: /config get token', |
|
99 |
'To check default token: /config get remote.default.token',
|
|
92 | 100 |
'If set/update a token:', |
93 |
'* (permanent): /config set token <token>', |
|
94 |
'* (temporary): re-run with <token> parameter'] |
|
101 |
'* (permanent): /config set remote.default.token <token>',
|
|
102 |
'* (temporary): re-run with <token> parameter'] + CLOUDNAME
|
|
95 | 103 |
|
96 | 104 |
@classmethod |
97 | 105 |
def load(this, foo): |
... | ... | |
103 | 111 |
raiseCLIError(ae, 'Client setup failure', importance=3) |
104 | 112 |
if not getattr(client, 'token', False): |
105 | 113 |
kloger.warning( |
106 |
'No permanent token (try: kamaki config set token <tkn>)') |
|
114 |
'No permanent token (try:' |
|
115 |
' kamaki config set remote.default.token <tkn>)') |
|
107 | 116 |
if not getattr(client, 'base_url', False): |
108 |
msg = 'Missing synnefo URL' |
|
117 |
msg = 'Missing synnefo authentication URL'
|
|
109 | 118 |
raise CLIError(msg, importance=3, details=[ |
110 | 119 |
'Check if authentication url is correct', |
111 |
' check current url: /config get url', |
|
112 |
' set new auth. url: /config set url']) |
|
120 |
' check current url:', |
|
121 |
' /config get remote.default.url', |
|
122 |
' set new auth. url:', |
|
123 |
' /config set remote.default.url'] + CLOUDNAME) |
|
113 | 124 |
return r |
114 | 125 |
return _raise |
115 | 126 |
|
... | ... | |
401 | 412 |
class pithos(object): |
402 | 413 |
container_howto = [ |
403 | 414 |
'To specify a container:', |
404 |
' 1. Set file.container variable (permanent)',
|
|
405 |
' /config set file.container <container>',
|
|
406 |
' 2. --container=<container> (temporary, overrides 1)',
|
|
407 |
' 3. Use the container:path format (temporary, overrides all)',
|
|
415 |
' 1. --container=<container> (temporary, overrides all)',
|
|
416 |
' 2. Use the container:path format (temporary, overrides 3)',
|
|
417 |
' 3. Set pithos_container variable (permanent)',
|
|
418 |
' /config set pithos_container <container>',
|
|
408 | 419 |
'For a list of containers: /file list'] |
409 | 420 |
|
410 | 421 |
@classmethod |
... | ... | |
435 | 446 |
raiseCLIError(ce, 'User quota exceeded', details=[ |
436 | 447 |
'* get quotas:', |
437 | 448 |
' * upper total limit: /file quota', |
438 |
' * container limit: /file quota <container>',
|
|
439 |
'* set a higher quota (if permitted):',
|
|
440 |
' /file setquota <quota>[unit] <container>'
|
|
441 |
' as long as <container quota> <= <total quota>'])
|
|
449 |
' * container limit:', |
|
450 |
' /file containerlimit get <container>',
|
|
451 |
'* set a higher container limit:',
|
|
452 |
' /file containerlimit set <limit> <container>'])
|
|
442 | 453 |
raise |
443 | 454 |
return _raise |
444 | 455 |
|
Also available in: Unified diff