Revision 5a1c22fe lib/luxi.py

b/lib/luxi.py
70 70

  
71 71

  
72 72
class ProtocolError(errors.GenericError):
73
  """Denotes an error in the LUXI protocol"""
73
  """Denotes an error in the LUXI protocol."""
74 74

  
75 75

  
76 76
class ConnectionClosedError(ProtocolError):
77
  """Connection closed error"""
77
  """Connection closed error."""
78 78

  
79 79

  
80 80
class TimeoutError(ProtocolError):
81
  """Operation timeout error"""
81
  """Operation timeout error."""
82 82

  
83 83

  
84 84
class RequestError(ProtocolError):
85
  """Error on request
85
  """Error on request.
86 86

  
87 87
  This signifies an error in the request format or request handling,
88 88
  but not (e.g.) an error in starting up an instance.
......
95 95

  
96 96

  
97 97
class NoMasterError(ProtocolError):
98
  """The master cannot be reached
98
  """The master cannot be reached.
99 99

  
100 100
  This means that the master daemon is not running or the socket has
101 101
  been removed.
......
103 103
  """
104 104

  
105 105

  
106
class PermissionError(ProtocolError):
107
  """Permission denied while connecting to the master socket.
108

  
109
  This means the user doesn't have the proper rights.
110

  
111
  """
112

  
113

  
106 114
class Transport:
107 115
  """Low-level transport class.
108 116

  
......
168 176
    except socket.timeout, err:
169 177
      raise TimeoutError("Connect timed out: %s" % str(err))
170 178
    except socket.error, err:
171
      if err.args[0] in (errno.ENOENT, errno.ECONNREFUSED):
179
      error_code = err.args[0]
180
      if error_code in (errno.ENOENT, errno.ECONNREFUSED):
172 181
        raise NoMasterError(address)
173
      if err.args[0] == errno.EAGAIN:
182
      elif error_code in (errno.EPERM, errno.EACCES):
183
        raise PermissionError(address)
184
      elif error_code == errno.EAGAIN:
174 185
        # Server's socket backlog is full at the moment
175 186
        raise utils.RetryAgain()
176 187
      raise

Also available in: Unified diff