Blame SOURCES/sos-bz1519267-haproxy-etcd-tracebacks.patch

8b0807
From 0b30e8f72c3c669455209d15b1eb01de20c7d578 Mon Sep 17 00:00:00 2001
8b0807
From: Louis Bouchard <louis@ubuntu.com>
8b0807
Date: Wed, 8 Nov 2017 14:15:36 +0100
8b0807
Subject: [PATCH] [haproxy] Fix py2 specific import syntax for urlparse
8b0807
8b0807
urlparse is now part of urllib in python3. Make sure that
8b0807
the proxy behaves correctly on both versions.
8b0807
8b0807
Closes: #1137
8b0807
8b0807
Signed-off-by: Louis Bouchard <louis@ubuntu.com>
8b0807
8b0807
Fixes: #1138
8b0807
8b0807
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
8b0807
---
8b0807
 sos/plugins/haproxy.py | 6 +++++-
8b0807
 1 file changed, 5 insertions(+), 1 deletion(-)
8b0807
8b0807
diff --git a/sos/plugins/haproxy.py b/sos/plugins/haproxy.py
8b0807
index 390b6ddb..eb696c9f 100644
8b0807
--- a/sos/plugins/haproxy.py
8b0807
+++ b/sos/plugins/haproxy.py
8b0807
@@ -15,9 +15,13 @@
8b0807
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
8b0807
 
8b0807
 from sos.plugins import Plugin, RedHatPlugin, DebianPlugin
8b0807
-from urlparse import urlparse
8b0807
 from re import match
8b0807
 
8b0807
+try:
8b0807
+    from urllib.parse import urlparse
8b0807
+except ImportError:
8b0807
+    from urlparse import urlparse
8b0807
+
8b0807
 
8b0807
 class HAProxy(Plugin, RedHatPlugin, DebianPlugin):
8b0807
     """HAProxy load balancer
8b0807
-- 
8b0807
2.13.6
8b0807
8b0807
From ae56ea578fe6f7443d2dce73e2b8fcf2bd5542d1 Mon Sep 17 00:00:00 2001
8b0807
From: Pavel Moravec <pmoravec@redhat.com>
8b0807
Date: Tue, 5 Dec 2017 12:44:42 +0100
8b0807
Subject: [PATCH] [etcd] dont traceback when etcd package isnt installed
8b0807
8b0807
catch exception when etcd package isnt installed and we inspect its
8b0807
version
8b0807
8b0807
Resolves: #1159
8b0807
8b0807
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
8b0807
---
8b0807
 sos/plugins/etcd.py | 17 +++++++++++------
8b0807
 1 file changed, 11 insertions(+), 6 deletions(-)
8b0807
8b0807
diff --git a/sos/plugins/etcd.py b/sos/plugins/etcd.py
8b0807
index bd5d10d8..d80bbeeb 100644
8b0807
--- a/sos/plugins/etcd.py
8b0807
+++ b/sos/plugins/etcd.py
8b0807
@@ -61,11 +61,16 @@ class etcd(Plugin, RedHatPlugin):
8b0807
                         return line.split('=')[1].replace('"', '').strip()
8b0807
         # If we can't read etcd.conf, assume defaults by etcd version
8b0807
         except:
8b0807
-            ver = self.policy().package_manager.get_pkg_list()['etcd']
8b0807
-            ver = ver['version'][0]
8b0807
-            if ver == '2':
8b0807
-                return 'http://localhost:4001'
8b0807
-            if ver == '3':
8b0807
-                return 'http://localhost:2379'
8b0807
+            # assume v3 is the default
8b0807
+            url = 'http://localhost:2379'
8b0807
+            try:
8b0807
+                ver = self.policy().package_manager.get_pkg_list()['etcd']
8b0807
+                ver = ver['version'][0]
8b0807
+                if ver == '2':
8b0807
+                    url = 'http://localhost:4001'
8b0807
+            except:
8b0807
+                # fallback when etcd is not installed
8b0807
+                pass
8b0807
+            return url
8b0807
 
8b0807
 # vim: et ts=5 sw=4
8b0807
-- 
8b0807
2.13.6
8b0807
8b0807
From 119593cff13b1d1d8d34b11fbb92893d70e634d6 Mon Sep 17 00:00:00 2001
8b0807
From: Pavel Moravec <pmoravec@redhat.com>
8b0807
Date: Tue, 5 Dec 2017 12:52:40 +0100
8b0807
Subject: [PATCH] [haproxy] catch exception when parsing haproxy.cfg
8b0807
8b0807
catch exception when parsed haproxy.cfg file isnt accessible
8b0807
8b0807
Resolves: #1160
8b0807
8b0807
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
8b0807
---
8b0807
 sos/plugins/haproxy.py | 14 +++++++++-----
8b0807
 1 file changed, 9 insertions(+), 5 deletions(-)
8b0807
8b0807
diff --git a/sos/plugins/haproxy.py b/sos/plugins/haproxy.py
8b0807
index eb696c9f..1807e6d7 100644
8b0807
--- a/sos/plugins/haproxy.py
8b0807
+++ b/sos/plugins/haproxy.py
8b0807
@@ -49,11 +49,15 @@ class HAProxy(Plugin, RedHatPlugin, DebianPlugin):
8b0807
         # from the next line
8b0807
         matched = None
8b0807
         provision_ip = None
8b0807
-        for line in open("/etc/haproxy/haproxy.cfg").read().splitlines():
8b0807
-            if matched:
8b0807
-                provision_ip = line.split()[1]
8b0807
-                break
8b0807
-            matched = match(".*haproxy\.stats.*", line)
8b0807
+        try:
8b0807
+            for line in open("/etc/haproxy/haproxy.cfg").read().splitlines():
8b0807
+                if matched:
8b0807
+                    provision_ip = line.split()[1]
8b0807
+                    break
8b0807
+                matched = match(".*haproxy\.stats.*", line)
8b0807
+        except:
8b0807
+            # fallback when the cfg file is not accessible
8b0807
+            pass
8b0807
 
8b0807
         if not provision_ip:
8b0807
             return
8b0807
-- 
8b0807
2.13.6
8b0807
8b0807
From 68e149809d5b487d0c5800b5a1a005aaad83c7be Mon Sep 17 00:00:00 2001
8b0807
From: Pavel Moravec <pmoravec@redhat.com>
8b0807
Date: Wed, 15 Nov 2017 17:43:45 +0100
8b0807
Subject: [PATCH] [docker] fix copy&paste error in a for cycle
8b0807
8b0807
"containers" is an unknown variable, "insp" is the correct one
8b0807
8b0807
Resolves: #1148
8b0807
8b0807
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
8b0807
---
8b0807
 sos/plugins/docker.py | 2 +-
8b0807
 1 file changed, 1 insertion(+), 1 deletion(-)
8b0807
8b0807
diff --git a/sos/plugins/docker.py b/sos/plugins/docker.py
8b0807
index fea4b96c..4f6c9882 100644
8b0807
--- a/sos/plugins/docker.py
8b0807
+++ b/sos/plugins/docker.py
8b0807
@@ -97,7 +97,7 @@ class Docker(Plugin):
8b0807
                     )
8b0807
                 )
8b0807
             if self.get_option('logs'):
8b0807
-                for container in containers:
8b0807
+                for container in insp:
8b0807
                     self.add_cmd_output(
8b0807
                         "{0} logs {1}".format(
8b0807
                             self.docker_cmd,
8b0807
-- 
8b0807
2.13.6
8b0807