Fix error message when masterd is not listening
authorMichael Hanselmann <hansmi@google.com>
Thu, 28 Aug 2008 15:35:55 +0000 (15:35 +0000)
committerMichael Hanselmann <hansmi@google.com>
Thu, 28 Aug 2008 15:35:55 +0000 (15:35 +0000)
Reported by Iustin.

Reviewed-by: iustinp

lib/cli.py
lib/luxi.py

index 2a70aef..879fe9b 100644 (file)
@@ -539,7 +539,7 @@ def FormatError(err):
     obuf.write("Unhandled Ganeti error: %s" % msg)
   elif isinstance(err, luxi.NoMasterError):
     obuf.write("Cannot communicate with the master daemon.\nIs it running"
-               " and listening on '%s'?" % err.args[0])
+               " and listening for connections?")
   elif isinstance(err, luxi.TimeoutError):
     obuf.write("Timeout while talking to the master daemon. Error:\n"
                "%s" % msg)
index 2faa8e8..5c48dd5 100644 (file)
@@ -154,7 +154,7 @@ class Transport:
       except socket.timeout, err:
         raise TimeoutError("Connect timed out: %s" % str(err))
       except socket.error, err:
-        if err.args[0] == errno.ENOENT:
+        if err.args[0] in (errno.ENOENT, errno.ECONNREFUSED):
           raise NoMasterError((address,))
         raise
       self.socket.settimeout(self._rwtimeout)