From 082c5adb5fdf08a4f8fa33a54d0cf827b94ee21c Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Thu, 28 Aug 2008 15:35:55 +0000
Subject: [PATCH] Fix error message when masterd is not listening

Reported by Iustin.

Reviewed-by: iustinp
---
 lib/cli.py  | 2 +-
 lib/luxi.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/cli.py b/lib/cli.py
index 2a70aefc3..879fe9b8e 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -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)
diff --git a/lib/luxi.py b/lib/luxi.py
index 2faa8e829..5c48dd56e 100644
--- a/lib/luxi.py
+++ b/lib/luxi.py
@@ -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)
-- 
GitLab