Blame SOURCES/sos-bz1206633-fix-exception-when-networkmanager-disabled.patch

3d26a2
From d19bc046d549aaf634314a257dd22623df731648 Mon Sep 17 00:00:00 2001
3d26a2
From: "Bryn M. Reeves" <bmr@redhat.com>
3d26a2
Date: Tue, 3 Mar 2015 14:54:48 +0000
3d26a2
Subject: [PATCH] [networking] test nmcli status before using output
3d26a2
3d26a2
The networking module assumes that nmcli commands succeed if the
3d26a2
results object is not None; this is not valid and will lead to
3d26a2
errors in subsequent commands if the call returned an error
3d26a2
message instead of the expected content:
3d26a2
3d26a2
  [plugin:networking] collecting output of 'nmcli con show conf 'Error: nmcli (0.9.10.0) and NetworkManager (unknown) versions don't match. Force execution using --nocheck, but the results are unpredictable.''
3d26a2
  Traceback (most recent call last):
3d26a2
    File "/usr/sbin/sosreport", line 25, in <module>
3d26a2
      main(sys.argv[1:])
3d26a2
    File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1459, in main
3d26a2
      sos.execute()
3d26a2
  ValueError: No closing quotation
3d26a2
3d26a2
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
3d26a2
---
3d26a2
 sos/plugins/networking.py | 4 ++--
3d26a2
 1 file changed, 2 insertions(+), 2 deletions(-)
3d26a2
3d26a2
diff --git a/sos/plugins/networking.py b/sos/plugins/networking.py
3d26a2
index 9f6ece0..ae6cb1b 100644
3d26a2
--- a/sos/plugins/networking.py
3d26a2
+++ b/sos/plugins/networking.py
3d26a2
@@ -142,13 +142,13 @@ class Networking(Plugin):
3d26a2
 
3d26a2
         nmcli_con_show_result = self.call_ext_prog(
3d26a2
             "nmcli --terse --fields NAME con show")
3d26a2
-        if nmcli_con_show_result:
3d26a2
+        if nmcli_con_show_result['status'] == 0:
3d26a2
             for con in nmcli_con_show_result['output'].splitlines():
3d26a2
                 self.add_cmd_output("nmcli con show conf '%s'" % con)
3d26a2
 
3d26a2
         nmcli_dev_status_result = self.call_ext_prog(
3d26a2
             "nmcli --terse --fields DEVICE dev status")
3d26a2
-        if nmcli_dev_status_result:
3d26a2
+        if nmcli_dev_status_result['status'] == 0:
3d26a2
             for dev in nmcli_dev_status_result['output'].splitlines():
3d26a2
                 self.add_cmd_output("nmcli device show "+dev)
3d26a2
 
3d26a2
-- 
3d26a2
1.8.3.1
3d26a2