Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[change] Wireless: avoid unnecessary network config #289 #298

Merged
merged 2 commits into from
Jul 9, 2024

Conversation

nemesifier
Copy link
Member

Avoid generating unnecessary config in /etc/config/network when defining wireless interfaces.

Closes #289

@nemesifier nemesifier self-assigned this Jun 7, 2024
@nemesifier nemesifier added this to In progress in OpenWISP Priorities for next releases via automation Jun 7, 2024
@coveralls
Copy link

Coverage Status

coverage: 99.541% (+0.002%) from 99.539%
when pulling 6c46ca1 on issues/289-openwrt-wireless-network-changes
into 0771906 on master.

self.assertEqual(o.config, self._wireless_interface_netjson)
self.assertDictEqual(o.config, self._wireless_interface_netjson)

_wireless_only_netjson = {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a couple of tests with the use case described by @thiagohflima in the original issue #289 (comment).

if len(static.get('ip6addr', [])) == 1:
static['ip6addr'] = static['ip6addr'][0]
result.append(static)
result.append(self.__intermediate_static_address(static))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to move the logic above to this method because flake8 was complaining about cyclomatic complexity due to the 2 lines I had to add above.

@coveralls
Copy link

Coverage Status

coverage: 99.541% (+0.002%) from 99.539%
when pulling eb192a0 on issues/289-openwrt-wireless-network-changes
into 0771906 on master.

@nemesifier nemesifier force-pushed the issues/289-openwrt-wireless-network-changes branch from eb192a0 to 331a144 Compare June 7, 2024 22:14
@coveralls
Copy link

Coverage Status

coverage: 99.541% (+0.002%) from 99.539%
when pulling 331a144 on issues/289-openwrt-wireless-network-changes
into 291f517 on master.

Avoid generating unnecessary config in /etc/config/network
when defining wireless interfaces.

Closes #289
There's no point in trying to attach a WiFi interface to itself.
It's unnecessary and can cause issues in some situations.
@nemesifier nemesifier force-pushed the issues/289-openwrt-wireless-network-changes branch from 1beb808 to ba2f9b8 Compare July 9, 2024 21:29
@coveralls
Copy link

Coverage Status

coverage: 99.54% (+0.002%) from 99.538%
when pulling ba2f9b8 on issues/289-openwrt-wireless-network-changes
into 176b51b on master.

@nemesifier nemesifier merged commit d0e9815 into master Jul 9, 2024
6 checks passed
OpenWISP Priorities for next releases automation moved this from In progress to Done Jul 9, 2024
@nemesifier nemesifier deleted the issues/289-openwrt-wireless-network-changes branch July 9, 2024 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

[change] When adding a Wireless config, should it add an interface?
2 participants