mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 02:15:17 +00:00
connections: workaround DeprecationWarning for NM.SettingEthtool.set_feature()
If present, use the newer API to avoid the deprecation warning:
$ pytest tests/unit/test_network_connections.py -v
...
tests/unit/test_network_connections.py::TestValidator::test_802_1x_1
/data/src/linux-system-roles-network/tests/unit/fake_env/network_connections.py:956: DeprecationWarning: NM.SettingEthtool.set_feature is deprecated
s_ethtool.set_feature(nm_feature, NM.Ternary.DEFAULT)
This commit is contained in:
parent
1f25fbb4fc
commit
a9f9c04a0b
1 changed files with 11 additions and 4 deletions
|
|
@ -952,12 +952,19 @@ class NMUtil:
|
|||
nm_feature = nm_provider.get_nm_ethtool_feature(feature)
|
||||
|
||||
if setting is None:
|
||||
if nm_feature:
|
||||
s_ethtool.set_feature(nm_feature, NM.Ternary.DEFAULT)
|
||||
if not nm_feature:
|
||||
continue
|
||||
val = NM.Ternary.DEFAULT
|
||||
elif setting:
|
||||
s_ethtool.set_feature(nm_feature, NM.Ternary.TRUE)
|
||||
val = NM.Ternary.TRUE
|
||||
else:
|
||||
s_ethtool.set_feature(nm_feature, NM.Ternary.FALSE)
|
||||
val = NM.Ternary.FALSE
|
||||
if not hasattr(s_ethtool, "option_set"):
|
||||
s_ethtool.set_feature(nm_feature, val)
|
||||
elif val == NM.Ternary.DEFAULT:
|
||||
s_ethtool.option_set(nm_feature, None)
|
||||
else:
|
||||
s_ethtool.option_set_boolean(nm_feature, val)
|
||||
|
||||
for coalesce, setting in connection["ethtool"]["coalesce"].items():
|
||||
nm_coalesce = nm_provider.get_nm_ethtool_coalesce(coalesce)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue