Revision 9ba38706 lib/cli.py

b/lib/cli.py
36 36
from ganeti import errors
37 37
from ganeti import constants
38 38
from ganeti import opcodes
39
from ganeti import luxi
39
import ganeti.rpc.errors as rpcerr
40 40
import ganeti.rpc.node as rpc
41 41
from ganeti import ssh
42 42
from ganeti import compat
......
2440 2440
    obuf.write("Parameter Error: %s" % msg)
2441 2441
  elif isinstance(err, errors.ParameterError):
2442 2442
    obuf.write("Failure: unknown/wrong parameter name '%s'" % msg)
2443
  elif isinstance(err, luxi.NoMasterError):
2443
  elif isinstance(err, rpcerr.NoMasterError):
2444 2444
    if err.args[0] == pathutils.MASTER_SOCKET:
2445 2445
      daemon = "the master daemon"
2446 2446
    elif err.args[0] == pathutils.QUERY_SOCKET:
......
2449 2449
      daemon = "socket '%s'" % str(err.args[0])
2450 2450
    obuf.write("Cannot communicate with %s.\nIs the process running"
2451 2451
               " and listening for connections?" % daemon)
2452
  elif isinstance(err, luxi.TimeoutError):
2452
  elif isinstance(err, rpcerr.TimeoutError):
2453 2453
    obuf.write("Timeout while talking to the master daemon. Jobs might have"
2454 2454
               " been submitted and will continue to run even if the call"
2455 2455
               " timed out. Useful commands in this situation are \"gnt-job"
2456 2456
               " list\", \"gnt-job cancel\" and \"gnt-job watch\". Error:\n")
2457 2457
    obuf.write(msg)
2458
  elif isinstance(err, luxi.PermissionError):
2458
  elif isinstance(err, rpcerr.PermissionError):
2459 2459
    obuf.write("It seems you don't have permissions to connect to the"
2460 2460
               " master daemon.\nPlease retry as a different user.")
2461
  elif isinstance(err, luxi.ProtocolError):
2461
  elif isinstance(err, rpcerr.ProtocolError):
2462 2462
    obuf.write("Unhandled protocol error while talking to the master daemon:\n"
2463 2463
               "%s" % msg)
2464 2464
  elif isinstance(err, errors.JobLost):
......
2543 2543

  
2544 2544
  try:
2545 2545
    result = func(options, args)
2546
  except (errors.GenericError, luxi.ProtocolError,
2546
  except (errors.GenericError, rpcerr.ProtocolError,
2547 2547
          JobSubmittedException), err:
2548 2548
    result, err_msg = FormatError(err)
2549 2549
    logging.exception("Error during command processing")
......
3706 3706
        ToStderr("Job %s%s has been archived, cannot check its result",
3707 3707
                 jid, self._IfName(name, " for %s"))
3708 3708
        success = False
3709
      except (errors.GenericError, luxi.ProtocolError), err:
3709
      except (errors.GenericError, rpcerr.ProtocolError), err:
3710 3710
        _, job_result = FormatError(err)
3711 3711
        success = False
3712 3712
        # the error message will always be shown, verbose or not

Also available in: Unified diff