diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2020-08-09 13:30:14 +0200 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2020-08-11 11:56:56 -0400 |
commit | 1426f663195c73126edec2a120336f338a936d31 (patch) | |
tree | 48ef0823977b408d37fb2357654b9b45e9d9695d | |
parent | e35e51dd8d928d68d5f207cc807c5d0707cb8711 (diff) | |
download | sos-1426f663195c73126edec2a120336f338a936d31.tar.gz |
[networkmanager] catch states when nmcli status fails
Catch situations when nmcli is not installed or returns nonzero;
status['output'] is then empty.
Resolves: #2191
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r-- | sos/report/plugins/networkmanager.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sos/report/plugins/networkmanager.py b/sos/report/plugins/networkmanager.py index e29f1dcb..976cbe1f 100644 --- a/sos/report/plugins/networkmanager.py +++ b/sos/report/plugins/networkmanager.py @@ -43,7 +43,8 @@ class NetworkManager(Plugin, RedHatPlugin, UbuntuPlugin): "general" # >= 0.9.9 ] status = self.exec_cmd(status_template % obj_table[version]) - return status['output'].lower().startswith("running") + return (status['status'] == 0 and + status['output'].lower().startswith("running")) # NetworkManager >= 0.9.9 (Use short name of objects for nmcli) if test_nm_status(version=1): |