diff options
author | Shane Bradley <sbradley@redhat.com> | 2015-05-18 11:25:15 -0400 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2015-05-21 17:09:44 +0100 |
commit | 5e99fcf891759f20060b742b1e4a567c2a431aee (patch) | |
tree | 190f9f0449e952805b015ea9f4540c72d4a96940 | |
parent | 4ac64362728365ae4830f46552a79a7c72327ce2 (diff) | |
download | sos-5e99fcf891759f20060b742b1e4a567c2a431aee.tar.gz |
[networking] nmcli incompatiblity issues
There are some incompatible changes in nmcli since the release of
NetworkManager >= 0.9.9. In addition, NetworkManager >= 0.9.9 will
use the long names of "nmcli" objects. This is documented in the
following article:
https://wiki.gnome.org/Projects/NetworkManager/nmcli
Signed-off-by: Shane Bradley <sbradley@redhat.com>
-rw-r--r-- | sos/plugins/networking.py | 66 |
1 files changed, 49 insertions, 17 deletions
diff --git a/sos/plugins/networking.py b/sos/plugins/networking.py index 369d8942..52b2f838 100644 --- a/sos/plugins/networking.py +++ b/sos/plugins/networking.py @@ -110,15 +110,59 @@ class Networking(Plugin): "ip neigh show", "ip neigh show nud noarp", "ip netns", - "nmcli general status", - "nmcli connection show", - "nmcli connection show active", - "nmcli device status", - "nmcli device show", "biosdevname -d", "tc -s qdisc show", "iptables -vnxL" ]) + + # There are some incompatible changes in nmcli since + # the release of NetworkManager >= 0.9.9. In addition, + # NetworkManager >= 0.9.9 will use the long names of + # "nmcli" objects. + + # NetworkManager >= 0.9.9 (Use long names of objects for nmcli) + nmcli_status_result = self.call_ext_prog("nmcli general status") + if nmcli_status_result['status'] == 0: + self.add_cmd_output([ + "nmcli general status", + "nmcli connection show", + "nmcli connection show --active", + "nmcli device status", + "nmcli device show"]) + nmcli_con_show_result = self.call_ext_prog( + "nmcli --terse --fields NAME con show") + if nmcli_con_show_result['status'] == 0: + for con in nmcli_con_show_result['output'].splitlines(): + self.add_cmd_output("nmcli connection show id '%s'" % con) + + nmcli_dev_status_result = self.call_ext_prog( + "nmcli --terse --fields DEVICE device status") + if nmcli_dev_status_result['status'] == 0: + for dev in nmcli_dev_status_result['output'].splitlines(): + self.add_cmd_output("nmcli device show '%s'" % dev) + + # NetworkManager < 0.9.9 (Use short name of objects for nmcli) + nmcli_status_result = self.call_ext_prog("nmcli nm status") + if nmcli_status_result['status'] == 0: + self.add_cmd_output([ + "nmcli nm status", + "nmcli con", + "nmcli con status", + "nmcli dev status", + "nmcli dev"]) + + nmcli_con_show_result = self.call_ext_prog( + "nmcli --terse --fields NAME con") + if nmcli_con_show_result['status'] == 0: + for con in nmcli_con_show_result['output'].splitlines(): + self.add_cmd_output("nmcli con list id '%s'" % con) + + nmcli_dev_status_result = self.call_ext_prog( + "nmcli --terse --fields DEVICE dev status") + if nmcli_dev_status_result['status'] == 0: + for dev in nmcli_dev_status_result['output'].splitlines(): + self.add_cmd_output("nmcli dev list iface '%s'" % dev) + ip_link_result = self.call_ext_prog("ip -o link") if ip_link_result['status'] == 0: for eth in self.get_eth_interfaces(ip_link_result['output']): @@ -141,18 +185,6 @@ class Networking(Plugin): "brctl showmacs "+br_name ]) - nmcli_con_show_result = self.call_ext_prog( - "nmcli --terse --fields NAME con show") - if nmcli_con_show_result['status'] == 0: - for con in nmcli_con_show_result['output'].splitlines(): - self.add_cmd_output("nmcli con show conf '%s'" % con) - - nmcli_dev_status_result = self.call_ext_prog( - "nmcli --terse --fields DEVICE dev status") - if nmcli_dev_status_result['status'] == 0: - for dev in nmcli_dev_status_result['output'].splitlines(): - self.add_cmd_output("nmcli device show "+dev) - if self.get_option("traceroute"): self.add_cmd_output("/bin/traceroute -n %s" % self.trace_host) |