From 39d1744aa8805dd61b95a82cf378dcaa91f85af7 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 9 Oct 2012 12:38:50 +0200
Subject: [PATCH] Fix usage of errors.ResolverError

This exception is documented to have three arguments, but in one case
we raise it with a simple string argument. Let's fix that.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/netutils.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/netutils.py b/lib/netutils.py
index 48d0f98b8..7ced860c7 100644
--- a/lib/netutils.py
+++ b/lib/netutils.py
@@ -229,7 +229,12 @@ class Hostname:
     try:
       return result[0][4][0]
     except IndexError, err:
-      raise errors.ResolverError("Unknown error in getaddrinfo(): %s" % err)
+      # we don't have here an actual error code, it's just that the
+      # data type returned by getaddrinfo is not what we expected;
+      # let's keep the same format in the exception arguments with a
+      # dummy error code
+      raise errors.ResolverError(hostname, 0,
+                                 "Unknown error in getaddrinfo(): %s" % err)
 
   @classmethod
   def GetNormalizedName(cls, hostname):
-- 
GitLab