From: Julien Fortin Date: Sat, 1 Dec 2018 01:16:01 +0000 (-0800) Subject: addons: ethtool: FEC: translate None and NotSupported values to link-fec off X-Git-Tag: 1.2.2-1~17 X-Git-Url: https://git.proxmox.com/?p=mirror_ifupdown2.git;a=commitdiff_plain;h=6328de59d202a8ef44fe7e9a99ffc47ea5f8d3b3 addons: ethtool: FEC: translate None and NotSupported values to link-fec off $ /sbin/ethtool --show-fec swp42 FEC parameters for swp42: FEC encodings : None $ ifquery swp42 auto swp42 iface swp42 link-fec off $ ifreload -av |& grep ethtool info: executing /sbin/ethtool swp42 info: executing /sbin/ethtool --show-fec swp42 $ Signed-off-by: Julien Fortin --- diff --git a/ifupdown2/addons/ethtool.py b/ifupdown2/addons/ethtool.py index dbf4196..3f1ea79 100644 --- a/ifupdown2/addons/ethtool.py +++ b/ifupdown2/addons/ethtool.py @@ -87,15 +87,17 @@ class ethtool(moduleBase,utilsBase): return # use only lowercase values - running_val = self.get_running_attr('fec', ifaceobj) + running_val = str(self.get_running_attr('fec', ifaceobj)).lower() - if running_val: - running_val = running_val.lower() if config_val: config_val = config_val.lower() if default_val: default_val = default_val.lower() + if running_val in ["none", "notsupported"]: + # None and NotSupported ethtool FEC values mean "off" + running_val = "off" + # check running values if config_val and config_val == running_val: return