fix: el7 interface functionality requires NetworkManager#323
fix: el7 interface functionality requires NetworkManager#323richm merged 1 commit intolinux-system-roles:mainfrom
Conversation
Reviewer's GuideEnsures NetworkManager is installed and running on EL7 for interface_pci_id support, refactors PCI ID parsing and warning handling to work without module.warn, and updates tests and vars to match the new behavior and EL7 requirements. Class diagram for updated firewall_lib PCI ID parsing and warningsclassDiagram
class FirewallLibModule {
+parse_pci_id(module, item) tuple
+main() void
}
class AnsibleModule {
+params dict
+warn(message)
+fail_json(msg)
+exit_json(changed, __firewall_changed, warnings)
}
class ParsePciIdResult {
+interface_names list
+warning string
}
FirewallLibModule ..> AnsibleModule : uses
FirewallLibModule ..> ParsePciIdResult : returns
%% Details of parse_pci_id behavior
class parse_pci_id_behavior {
+validate_online_mode()
+match_pci_regex(item)
+get_interface_pci()
+handle_found_interface()
+handle_missing_interface_with_warn()
+handle_invalid_format()
}
FirewallLibModule ..> parse_pci_id_behavior : implements
%% Details inside main related to warnings and interface_pci_id
class main_behavior {
+warnings list
+handle_allow_zone_drifting_deprecated()
+iterate_interface_pci_ids()
+append_interfaces(interface_names)
+collect_warnings(warning)
+exit_with_warnings()
}
FirewallLibModule ..> main_behavior : implements
class AllowZoneDriftingHandling {
+check_firewalld_conf()
+check_version()
+call_module_warn_or_collect_warning()
}
main_behavior ..> AllowZoneDriftingHandling : uses
AllowZoneDriftingHandling ..> AnsibleModule : uses warn()
class InterfacePciIdHandling {
+call_parse_pci_id()
+extend_interface_param()
+collect_pci_warnings()
}
main_behavior ..> InterfacePciIdHandling : uses
InterfacePciIdHandling ..> FirewallLibModule : calls parse_pci_id()
InterfacePciIdHandling ..> AnsibleModule : uses params
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Installing
NetworkManagerunconditionally in__firewall_packages_extrafor all RHEL/CentOS < 8 may be heavier than necessary; consider scoping this dependency to cases whereinterface_pci_idfunctionality is actually used (e.g., via a separate variable or conditional include) to avoid forcing it on all consumers. - The pattern
callable(getattr(module, 'warn', None))is now repeated in several places; consider extracting a small helper (e.g.,_emit_warning(module, msg, warnings_list)) to centralize the logic for usingmodule.warnvs. accumulating in thewarningslist.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Installing `NetworkManager` unconditionally in `__firewall_packages_extra` for all RHEL/CentOS < 8 may be heavier than necessary; consider scoping this dependency to cases where `interface_pci_id` functionality is actually used (e.g., via a separate variable or conditional include) to avoid forcing it on all consumers.
- The pattern `callable(getattr(module, 'warn', None))` is now repeated in several places; consider extracting a small helper (e.g., `_emit_warning(module, msg, warnings_list)`) to centralize the logic for using `module.warn` vs. accumulating in the `warnings` list.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
2dfba8e to
fe1f742
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #323 +/- ##
==========================================
- Coverage 61.09% 58.20% -2.90%
==========================================
Files 2 2
Lines 910 1304 +394
==========================================
+ Hits 556 759 +203
- Misses 354 545 +191
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fe1f742 to
17e0353
Compare
|
[citest] |
17e0353 to
cb136b0
Compare
|
[citest] |
Cause: NetworkManager is not installed on some EL7 systems by default. Consequence: The interface_pci_id could not be found. Fix: Ensure NetworkManager is installed on EL7. Result: The interface_pci_id can be used on EL7. Also - `module.warn` is deprecated - use `warnings` instead if `module.warn` is not supported. Fix the interface pci test to ensure NetworkManager is running before the test. add warnings parameter for tests Signed-off-by: Rich Megginson <rmeggins@redhat.com>
cb136b0 to
ed321a9
Compare
|
[citest] |
|
[citest_bad] |
1 similar comment
|
[citest_bad] |
Cause: NetworkManager is not installed on some EL7 systems by default.
Consequence: The interface_pci_id could not be found.
Fix: Ensure NetworkManager is installed on EL7.
Result: The interface_pci_id can be used on EL7.
Also -
module.warnis deprecated - usewarningsinstead ifmodule.warnisnot supported.
Fix the interface pci test to ensure NetworkManager is running before the test.
Signed-off-by: Rich Megginson rmeggins@redhat.com
Summary by Sourcery
Ensure interface_pci_id functionality works reliably on EL7 systems and surface deprecation warnings without relying on module.warn support.
Bug Fixes:
Enhancements:
Tests:
Chores: