From d737409685ddb98795e7160f33ab679e194a5440 Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Sat, 14 Jan 2023 17:50:43 -0800 Subject: [PATCH] Clean up / Workaround non-inclusive words - CHANGELOG.md - README.md - contributing.md - library/network_connections.py - module_utils/network_lsr/argument_validator.py - module_utils/network_lsr/ethtool.py - tests/ensure_provider_tests.py - tests/playbooks/tests_bond_options.yml - tests/unit/test_network_connections.py Signed-off-by: Noriko Hosoi --- CHANGELOG.md | 6 ++-- README.md | 1 + contributing.md | 2 +- library/network_connections.py | 29 +++++++++++-------- .../network_lsr/argument_validator.py | 5 ++-- module_utils/network_lsr/ethtool.py | 2 ++ tests/ensure_provider_tests.py | 2 +- tests/playbooks/tests_bond_options.yml | 1 + tests/unit/test_network_connections.py | 12 ++++++-- 9 files changed, 38 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 568e88fbd..7de9306cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -170,15 +170,15 @@ Changelog ### Changes - Use inclusive language -- `slave` is deprecated in favor of `port` -- `master` is deprecated in favor of `controller` +- `slave` is deprecated in favor of `port` +- `master` is deprecated in favor of `controller` ### New features - Support disabling IPv6 - Support `dns_options` when using one or more IPv4 nameservers - Support Ethtool coalesce settings -- Support dummy interfaces +- Support dummy interfaces ### Bug fixes diff --git a/README.md b/README.md index a9f29fbd2..d0f7aa1cf 100644 --- a/README.md +++ b/README.md @@ -843,6 +843,7 @@ following options: - `all_ports_active` + `all_slaves_active` in kernel and NetworkManager. The boolean value `false` drops the duplicate frames (received on inactive ports) and the boolean value `true` delivers the duplicate frames. diff --git a/contributing.md b/contributing.md index 7e371e84a..66c704eea 100644 --- a/contributing.md +++ b/contributing.md @@ -399,7 +399,7 @@ comment. The available commands are: - [citest] - Trigger a re-test for all machines. - [citest bad] - Trigger a re-test for all machines with an error or failure status. - [citest pending] - Trigger a re-test for all machines with a pending status. -- [citest commit:] - Whitelist a commit to be tested if the submitter is not +- [citest commit:] - Specify a commit to be tested if the submitter is not trusted. How to reach us diff --git a/library/network_connections.py b/library/network_connections.py index ee9b75237..4fc93b524 100644 --- a/library/network_connections.py +++ b/library/network_connections.py @@ -140,9 +140,10 @@ def _link_infos_fetch(): links = {} for ifname in os.listdir("/sys/class/net/"): if not os.path.islink("/sys/class/net/" + ifname): - # /sys/class/net may contain certain entries that are not - # interface names, like 'bonding_master'. Skip over files - # that are not links. + # /sys/class/net may contain certain entries + # that are not interface names, like + # 'bonding_master'. # wokeignore:rule=master + # Skip over files that are not links. continue links[ifname] = { "ifindex": SysUtil._link_read_ifindex(ifname), @@ -359,7 +360,7 @@ def ifcfg_create( ifcfg["TYPE"] = "Bridge" elif connection["type"] == "bond": ifcfg["TYPE"] = "Bond" - ifcfg["BONDING_MASTER"] = "yes" + ifcfg["BONDING_MASTER"] = "yes" # wokeignore:rule=master opts = ["mode=%s" % (connection["bond"]["mode"])] if connection["bond"]["miimon"] is not None: opts.append(" miimon=%s" % (connection["bond"]["miimon"])) @@ -452,10 +453,10 @@ def ifcfg_create( if connection["port_type"] == "bridge": ifcfg["BRIDGE"] = m elif connection["port_type"] == "bond": - ifcfg["MASTER"] = m - ifcfg["SLAVE"] = "yes" + ifcfg["MASTER"] = m # wokeignore:rule=master + ifcfg["SLAVE"] = "yes" # wokeignore:rule=slave elif connection["port_type"] == "team": - ifcfg["TEAM_MASTER"] = m + ifcfg["TEAM_MASTER"] = m # wokeignore:rule=master if "TYPE" in ifcfg: del ifcfg["TYPE"] if connection["type"] != "team": @@ -894,13 +895,15 @@ def connection_create(self, connections, idx, connection_current=None): if option in ["all_ports_active", "use_carrier", "tlb_dynamic_lb"]: value = int(value) if option in ["all_ports_active", "packets_per_port"]: - option = option.replace("port", "slave") + option = option.replace("port", "slave") # wokeignore:rule=slave s_bond.add_option(option, str(value)) elif connection["type"] == "team": s_con.set_property(NM.SETTING_CONNECTION_TYPE, NM.SETTING_TEAM_SETTING_NAME) - elif connection["type"] == "dummy": + elif connection["type"] == "dummy": # wokeignore:rule=dummy s_con.set_property( - NM.SETTING_CONNECTION_TYPE, NM.SETTING_DUMMY_SETTING_NAME + # wokeignore:rule=dummy + NM.SETTING_CONNECTION_TYPE, + NM.SETTING_DUMMY_SETTING_NAME, ) elif connection["type"] == "vlan": s_con.set_property(NM.SETTING_CONNECTION_TYPE, NM.SETTING_VLAN_SETTING_NAME) @@ -1045,10 +1048,12 @@ def connection_create(self, connections, idx, connection_current=None): if connection["controller"] is not None: s_con.set_property( - NM.SETTING_CONNECTION_SLAVE_TYPE, connection["port_type"] + # wokeignore:rule=slave + NM.SETTING_CONNECTION_SLAVE_TYPE, + connection["port_type"], ) s_con.set_property( - NM.SETTING_CONNECTION_MASTER, + NM.SETTING_CONNECTION_MASTER, # wokeignore:rule=master ArgUtil.connection_find_controller_uuid( connection["controller"], connections, idx ), diff --git a/module_utils/network_lsr/argument_validator.py b/module_utils/network_lsr/argument_validator.py index fb22f9360..d4cb3b57f 100644 --- a/module_utils/network_lsr/argument_validator.py +++ b/module_utils/network_lsr/argument_validator.py @@ -1794,7 +1794,7 @@ class ArgValidator_DictConnection(ArgValidatorDict): "vlan", "macvlan", "wireless", - "dummy", + "dummy", # wokeignore:rule=dummy ] VALID_PORT_TYPES = ["bridge", "bond", "team"] @@ -1828,10 +1828,11 @@ def __init__(self): enum_values=ArgValidator_DictConnection.VALID_PORT_TYPES, ), ArgValidatorDeprecated( - "slave_type", + "slave_type", # wokeignore:rule=slave deprecated_by="port_type", ), ArgValidatorStr("controller"), + # wokeignore:rule=master ArgValidatorDeprecated("master", deprecated_by="controller"), ArgValidatorStr("interface_name", allow_empty=True), ArgValidatorMac("mac"), diff --git a/module_utils/network_lsr/ethtool.py b/module_utils/network_lsr/ethtool.py index f8a442a3e..b47ec1df8 100644 --- a/module_utils/network_lsr/ethtool.py +++ b/module_utils/network_lsr/ethtool.py @@ -23,7 +23,9 @@ def get_perm_addr(ifname): ETHTOOL_GPERMADDR ioctl command. Please for further documentation, see: + wokeignore:rule=master https://github.com/torvalds/linux/blob/master/include/uapi/linux/ethtool.h#L734 + wokeignore:rule=master https://github.com/torvalds/linux/blob/master/include/uapi/linux/ethtool.h#L1388 https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/tree/ethtool.c#n4172 """ diff --git a/tests/ensure_provider_tests.py b/tests/ensure_provider_tests.py index 0c6e9f7e4..b87b3bf20 100755 --- a/tests/ensure_provider_tests.py +++ b/tests/ensure_provider_tests.py @@ -67,7 +67,7 @@ }, "playbooks/tests_bond_options.yml": {}, "playbooks/tests_eth_dns_support.yml": {}, - "playbooks/tests_dummy.yml": {}, + "playbooks/tests_dummy.yml": {}, # wokeignore:rule=dummy "playbooks/tests_infiniband.yml": {}, "playbooks/tests_ipv6_disabled.yml": {}, "playbooks/tests_ipv6_dns_search.yml": {}, diff --git a/tests/playbooks/tests_bond_options.yml b/tests/playbooks/tests_bond_options.yml index ebd6b9fc7..2cb5d95ee 100644 --- a/tests/playbooks/tests_bond_options.yml +++ b/tests/playbooks/tests_bond_options.yml @@ -88,6 +88,7 @@ - { key: 'ad_actor_system', value: '00:00:5e:00:53:5d'} - { key: 'ad_select', value: 'stable'} - { key: 'ad_user_port_key', value: '1023'} + # wokeignore:rule=slave - { key: 'all_slaves_active', value: '1'} - { key: 'downdelay', value: '0'} - { key: 'lacp_rate', value: 'slow'} diff --git a/tests/unit/test_network_connections.py b/tests/unit/test_network_connections.py index 95c94371f..dde96665e 100644 --- a/tests/unit/test_network_connections.py +++ b/tests/unit/test_network_connections.py @@ -4226,8 +4226,10 @@ def test_route_metric6_configured_ipv6_disabled(self): route_metric6_configured_ipv6_disabled, ) + # wokeignore:rule=master def test_set_deprecated_master(self): """ + wokeignore:rule=master When passing the deprecated "master" it is updated to "controller". """ input_connections = [ @@ -4241,17 +4243,20 @@ def test_set_deprecated_master(self): "state": "up", "type": "ethernet", "interface_name": "eth1", - "master": "prod2", + "master": "prod2", # wokeignore:rule=master }, ] connections = ARGS_CONNECTIONS.validate(input_connections) self.assertTrue(len(connections) == 2) for connection in connections: self.assertTrue("controller" in connection) + # wokeignore:rule=master self.assertTrue("master" not in connection) + # wokeignore:rule=slave def test_set_deprecated_slave_type(self): """ + wokeignore:rule=slave When passing the deprecated "slave_type" it is updated to "port_type". """ input_connections = [ @@ -4266,13 +4271,14 @@ def test_set_deprecated_slave_type(self): "type": "ethernet", "interface_name": "eth1", "controller": "prod2", - "slave_type": "bridge", + "slave_type": "bridge", # wokeignore:rule=slave }, ] connections = ARGS_CONNECTIONS.validate(input_connections) self.assertTrue(len(connections) == 2) for connection in connections: self.assertTrue("port_type" in connection) + # wokeignore:rule=slave self.assertTrue("slave_type" not in connection) @@ -4376,7 +4382,7 @@ def test_match_path_invalid_connection_type(self): result = self.validator.validate(self.test_profile) self.assertEqual(result["match"], {"path": ["pci-0000:00:03.0"]}) - self.test_profile["type"] = "dummy" + self.test_profile["type"] = "dummy" # wokeignore:rule=dummy self.assertRaisesRegex( ValidationError, "'match.path' settings are only supported for type 'ethernet' or 'infiniband'",