File 0005-Catch-exception-if-socket.gethostbyaddr-fails.patch of Package openlmi-providers
From 5a607aeb9ca08efd969d2cf3f61058e9e1919c64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
Date: Mon, 18 Nov 2013 11:22:52 -0700
Subject: [PATCH 5/7] Catch exception if socket.gethostbyaddr fails
---
src/python/lmi/providers/__init__.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/python/lmi/providers/__init__.py b/src/python/lmi/providers/__init__.py
index 9ee8376a1aee..1d622b78bc0f 100644
--- a/src/python/lmi/providers/__init__.py
+++ b/src/python/lmi/providers/__init__.py
@@ -53,5 +53,8 @@ def is_this_system(system_name):
:rtype: boolean
"""
- return ( socket.gethostbyaddr(system_name)[0]
- == socket.gethostbyaddr(socket.gethostname())[0])
+ try:
+ return ( socket.gethostbyaddr(system_name)[0]
+ == socket.gethostbyaddr(socket.gethostname())[0])
+ except OSError as e:
+ return false
\ No newline at end of file
--
1.8.4