Repository navigation
feat: Enhance DHCP release process with dhclient check and logging - #48
Merged
Merged
Conversation
Contributor
|
We don't publish DEVs .whl. |
There was a problem hiding this comment.
Pull request overview
This PR enhances the Linux DHCP release workflow by adding a dhclient presence check and emitting a debug log when the DHCP release step is skipped, along with unit tests for the new branches.
Changes:
- Add a pre-check for
dhclientavailability before attemptingdhclient -rinLinuxIP.release_ip(). - Log a debug message when
dhclientis not found and the DHCP release step is skipped. - Add unit tests covering the “dhclient not found” path and error propagation from
dhclient -r.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
mfd_network_adapter/network_interface/feature/ip/linux.py |
Adds dhclient existence check and skip-logging to the Linux IP release flow. |
tests/unit/test_mfd_network_adapter/test_network_interface/test_feature/test_ip/test_ip_linux.py |
Adds unit tests for the new release_ip() branches (dhclient missing / dhclient error). |
Comments suppressed due to low confidence (1)
mfd_network_adapter/network_interface/feature/ip/linux.py:206
ip -{ip_version} addr flush dev ...is executed withoutadd_namespace_call_command(...). If the interface is in a network namespace, the flush will run in the default namespace and likely fail / flush the wrong context. Please apply the same namespace wrapping used elsewhere in this module (e.g.,del_all_ips()usesadd_namespace_call_command).
cmd = f"ip -{ip_version.value} addr flush dev {self._interface().name}"
self._connection.execute_command(cmd)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Lasota, Adrian <adrian.lasota@intel.com>
DawidBerk
approved these changes
May 15, 2026
mchromin
approved these changes
May 18, 2026
a-gorczew
approved these changes
May 18, 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 improves the robustness of the
release_ipmethod in the Linux IP feature implementation by handling cases wheredhclientis not present, and updates the corresponding unit tests to cover these scenarios.Enhancements to
release_ipmethod:dhclientis available before attempting to release the DHCP lease, and logs a debug message if it is not found.ip addr flushcommand is always run in the correct network namespace by wrapping it withadd_namespace_call_command.Unit test improvements:
dhclientis not found, ensuring the method skips the DHCP release step and still flushes the IP address.dhclientfails with an unexpected error.