fix: Add require_installed decorator to FreeBsdIP methods for interfa…#41
Merged
fix: Add require_installed decorator to FreeBsdIP methods for interfa…#41
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds validation to ensure that IP-related operations on FreeBSD network interfaces can only be performed when the interface is installed. A new decorator enforces this check across multiple methods, preventing operations on uninstalled interfaces.
Changes:
- Introduced a
require_installeddecorator that validates interface installation status before executing IP management methods - Applied the decorator to eight methods in the
FreeBsdIPclass:get_ips,add_ip,del_ip,enable_dynamic_ip,set_ipv6_autoconf,has_tentative_address,wait_till_tentative_exit, andget_ipv6_autoconf - Added unit test to verify the decorator raises
IPFeatureExceptionwhen attempting operations on uninstalled interfaces
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| mfd_network_adapter/network_interface/feature/ip/freebsd.py | Implements the require_installed decorator and applies it to IP management methods to enforce installation status checks |
| tests/unit/test_mfd_network_adapter/test_network_interface/test_feature/test_ip/test_ip_freebsd.py | Adds test case to verify the decorator correctly prevents IP operations on uninstalled interfaces |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
561877a to
85a378b
Compare
Contributor
|
We don't publish DEVs .whl. |
49db71e to
24c5272
Compare
DawidBerk
approved these changes
Jan 28, 2026
DawidBerk
approved these changes
Jan 28, 2026
abaczek
previously approved these changes
Jan 30, 2026
mchromin
previously approved these changes
Jan 30, 2026
e247337 to
798b30b
Compare
…ce validation Signed-off-by: Lasota, Adrian <adrian.lasota@intel.com>
798b30b to
7aee8ea
Compare
mchromin
approved these changes
Mar 5, 2026
abaczek
approved these changes
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new decorator to ensure that IP-related operations on FreeBSD network interfaces are only performed when the interface is installed. The decorator is applied to several methods in the
FreeBsdIPclass, and corresponding unit tests are added to verify this behavior.Decorator for interface installation state:
require_installeddecorator infreebsd.pyto check if the network interface is installed before executing key IP management methods. If the interface is not installed, anIPFeatureExceptionis raised.@require_installeddecorator to the following methods inFreeBsdIP:get_ips,add_ip,del_ip,enable_dynamic_ip,set_ipv6_autoconf,has_tentative_address,wait_till_tentative_exit, andget_ipv6_autoconf, ensuring these operations cannot proceed on uninstalled interfaces. [1] [2] [3] [4] [5] [6] [7] [8]Testing:
test_installed_wrapper) to verify that attempting to add an IP address to an uninstalled interface raises the expectedIPFeatureException.