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