Revision e2e521d0
b/lib/cli.py | ||
---|---|---|
370 | 370 |
""" |
371 | 371 |
retcode = 1 |
372 | 372 |
obuf = StringIO() |
373 |
msg = str(err) |
|
373 | 374 |
if isinstance(err, errors.ConfigurationError): |
374 |
msg = "Corrupt configuration file: %s" % err
|
|
375 |
logger.Error(msg)
|
|
376 |
obuf.write(msg + "\n")
|
|
375 |
txt = "Corrupt configuration file: %s" % msg
|
|
376 |
logger.Error(txt)
|
|
377 |
obuf.write(txt + "\n")
|
|
377 | 378 |
obuf.write("Aborting.") |
378 | 379 |
retcode = 2 |
379 | 380 |
elif isinstance(err, errors.HooksAbort): |
... | ... | |
386 | 387 |
obuf.write(" node: %s, script: %s (no output)\n" % |
387 | 388 |
(node, script)) |
388 | 389 |
elif isinstance(err, errors.HooksFailure): |
389 |
obuf.write("Failure: hooks general failure: %s" % str(err))
|
|
390 |
obuf.write("Failure: hooks general failure: %s" % msg)
|
|
390 | 391 |
elif isinstance(err, errors.ResolverError): |
391 | 392 |
this_host = utils.HostInfo.SysName() |
392 | 393 |
if err.args[0] == this_host: |
... | ... | |
396 | 397 |
obuf.write(msg % err.args[0]) |
397 | 398 |
elif isinstance(err, errors.OpPrereqError): |
398 | 399 |
obuf.write("Failure: prerequisites not met for this" |
399 |
" operation:\n%s" % str(err))
|
|
400 |
" operation:\n%s" % msg)
|
|
400 | 401 |
elif isinstance(err, errors.OpExecError): |
401 |
obuf.write("Failure: command execution error:\n%s" % str(err))
|
|
402 |
obuf.write("Failure: command execution error:\n%s" % msg)
|
|
402 | 403 |
elif isinstance(err, errors.TagError): |
403 |
obuf.write("Failure: invalid tag(s) given:\n%s" % str(err))
|
|
404 |
obuf.write("Failure: invalid tag(s) given:\n%s" % msg)
|
|
404 | 405 |
elif isinstance(err, errors.GenericError): |
405 |
obuf.write("Unhandled Ganeti error: %s" % str(err))
|
|
406 |
obuf.write("Unhandled Ganeti error: %s" % msg)
|
|
406 | 407 |
else: |
407 |
obuf.write("Unhandled exception: %s" % str(err))
|
|
408 |
obuf.write("Unhandled exception: %s" % msg)
|
|
408 | 409 |
return retcode, obuf.getvalue().rstrip('\n') |
409 | 410 |
|
410 | 411 |
|
Also available in: Unified diff