diff --git a/CHANGELOG.md b/CHANGELOG.md index 568e88f..7de9306 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 a9f29fb..d0f7aa1 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 7e371e8..66c704e 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 ee9b752..3e6eda9 100644 --- a/library/network_connections.py +++ b/library/network_connections.py @@ -140,9 +140,11 @@ class SysUtil: 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 + # wokeignore:rule=master + # 'bonding_master'. + # Skip over files that are not links. continue links[ifname] = { "ifindex": SysUtil._link_read_ifindex(ifname), @@ -359,6 +361,7 @@ class IfcfgUtil: ifcfg["TYPE"] = "Bridge" elif connection["type"] == "bond": ifcfg["TYPE"] = "Bond" + # wokeignore:rule=master ifcfg["BONDING_MASTER"] = "yes" opts = ["mode=%s" % (connection["bond"]["mode"])] if connection["bond"]["miimon"] is not None: @@ -452,9 +455,12 @@ class IfcfgUtil: if connection["port_type"] == "bridge": ifcfg["BRIDGE"] = m elif connection["port_type"] == "bond": + # wokeignore:rule=master ifcfg["MASTER"] = m + # wokeignore:rule=slave ifcfg["SLAVE"] = "yes" elif connection["port_type"] == "team": + # wokeignore:rule=master ifcfg["TEAM_MASTER"] = m if "TYPE" in ifcfg: del ifcfg["TYPE"] @@ -894,13 +900,17 @@ class NMUtil: if option in ["all_ports_active", "use_carrier", "tlb_dynamic_lb"]: value = int(value) if option in ["all_ports_active", "packets_per_port"]: + # wokeignore:rule=slave option = option.replace("port", "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) + # wokeignore:rule=dummy elif connection["type"] == "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,9 +1055,12 @@ class NMUtil: 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( + # wokeignore:rule=master NM.SETTING_CONNECTION_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 fb22f93..871cd5b 100644 --- a/module_utils/network_lsr/argument_validator.py +++ b/module_utils/network_lsr/argument_validator.py @@ -1794,6 +1794,7 @@ class ArgValidator_DictConnection(ArgValidatorDict): "vlan", "macvlan", "wireless", + # wokeignore:rule=dummy "dummy", ] VALID_PORT_TYPES = ["bridge", "bond", "team"] @@ -1828,10 +1829,12 @@ class ArgValidator_DictConnection(ArgValidatorDict): enum_values=ArgValidator_DictConnection.VALID_PORT_TYPES, ), ArgValidatorDeprecated( + # wokeignore:rule=slave "slave_type", 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 f8a442a..b47ec1d 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 0c6e9f7..b87b3bf 100755 --- a/tests/ensure_provider_tests.py +++ b/tests/ensure_provider_tests.py @@ -67,7 +67,7 @@ ibution_major_version | int < 9", }, "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 ebd6b9f..2cb5d95 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 95c9437..dde9666 100644 --- a/tests/unit/test_network_connections.py +++ b/tests/unit/test_network_connections.py @@ -4226,8 +4226,10 @@ class TestValidator(Python26CompatTestCase): 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 @@ class TestValidator(Python26CompatTestCase): "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 @@ class TestValidator(Python26CompatTestCase): "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 @@ class TestValidatorMatch(Python26CompatTestCase): 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'",