feat: Support extra dracut settings for static IP#268
Conversation
Feature: Introduce the nbde_client_extra_dracut_settings variable. This is a list of strings written to /etc/dracut.conf.d/nbde_client.conf in addition to the implicit platform-specific __nbde_client_dracut_settings. Reason: NBDE clients with static IP addressing need custom early-boot network settings in dracut (for example kernel_cmdline with a static ip= and nameserver). Previously the role only wrote fixed platform settings, so users had to disable early boot or manage dracut config outside the role. Result: Users can pass extra dracut configuration lines via nbde_client_extra_dracut_settings (documented in README.md) while keeping the role's implicit settings. A new integration test verifies the static IP kernel_cmdline example is written to the conf file. Assisted-by: Cursor using models Cursor Grok 4.5, Composer 2.5, Sonnet 5 Signed-off-by: Rich Megginson <rmeggins@redhat.com>
📝 WalkthroughWalkthroughChangesThe role adds Extra dracut settings
Possibly related PRs
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8)defaults/main.ymlTraceback (most recent call last): tests/tests_default_vars.ymlTraceback (most recent call last): tests/tests_extra_dracut_settings.ymlTraceback (most recent call last): Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
tests/tests_extra_dracut_settings.yml (1)
1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove AI-generation artifact.
Consider removing this auto-generated comment before merging, as it does not add value to the codebase.
♻️ Proposed fix
-# Generated by: Cursor using models Cursor Grok 4.5, Composer 2.5, Sonnet 5🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/tests_extra_dracut_settings.yml` at line 1, Remove the auto-generated “Generated by” comment from tests/tests_extra_dracut_settings.yml, leaving the file content otherwise unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/tests_extra_dracut_settings.yml`:
- Around line 11-13: Extend the test task block in
tests_extra_dracut_settings.yml with a failure scenario for
nbde_client_extra_dracut_settings, passing an invalid value such as a dictionary
instead of a list of strings and asserting that role execution fails. Preserve
the existing success and idempotency checks.
- Around line 8-18: Update tests/tests_extra_dracut_settings.yml at lines 8-18
and 49-53: use ansible.builtin.include_tasks for both wrapper invocations, and
move nbde_client_extra_dracut_settings from the play-level vars into each
invocation’s vars block. Do not alter the other tasks unless required for these
corrections.
---
Nitpick comments:
In `@tests/tests_extra_dracut_settings.yml`:
- Line 1: Remove the auto-generated “Generated by” comment from
tests/tests_extra_dracut_settings.yml, leaving the file content otherwise
unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 568d5884-403a-4e72-ab2c-a1cabc7d5491
📒 Files selected for processing (5)
README.mddefaults/main.ymltemplates/nbde_client.conftests/tests_default_vars.ymltests/tests_extra_dracut_settings.yml
| nbde_client_extra_dracut_settings: | ||
| - "{{ __nbde_client_test_extra_dracut_line }}" | ||
|
|
||
| tasks: | ||
| - name: Run the test | ||
| block: | ||
| - name: Use nbde_client role | ||
| include_tasks: tasks/run_role_with_clear_facts.yml | ||
| vars: | ||
| __sr_public: true | ||
|
|
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Align role invocations with path instructions.
Both role invocations in this test define the input variables at the play level and omit the ansible.builtin. prefix, which violates the role invocation pattern required by the path instructions. The role configuration variables must be passed directly within the vars block of the centrally managed wrapper.
tests/tests_extra_dracut_settings.yml#L8-L18: Useansible.builtin.include_tasksand movenbde_client_extra_dracut_settingsfrom the play'svarsinto this task'svarsblock.tests/tests_extra_dracut_settings.yml#L49-L53: Apply the same correction to the idempotency run, using the FQCN and includingnbde_client_extra_dracut_settingsin itsvarsblock.
(Note: Consider adding the ansible.builtin. prefix to the other tasks in this file—such as slurp, set_fact, assert, and file—to fully align with modern Ansible best practices.)
📍 Affects 1 file
tests/tests_extra_dracut_settings.yml#L8-L18(this comment)tests/tests_extra_dracut_settings.yml#L49-L53
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/tests_extra_dracut_settings.yml` around lines 8 - 18, Update
tests/tests_extra_dracut_settings.yml at lines 8-18 and 49-53: use
ansible.builtin.include_tasks for both wrapper invocations, and move
nbde_client_extra_dracut_settings from the play-level vars into each
invocation’s vars block. Do not alter the other tasks unless required for these
corrections.
Source: Path instructions
| tasks: | ||
| - name: Run the test | ||
| block: |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Verify failure scenarios in the test.
As per path instructions, "Tests should verify both success and failure scenarios". This test currently only validates the success path and idempotency. Please add an additional task block that expects a failure (for example, by intentionally providing an invalid type, such as a dictionary instead of a list of strings, to nbde_client_extra_dracut_settings and asserting that the role execution fails).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/tests_extra_dracut_settings.yml` around lines 11 - 13, Extend the test
task block in tests_extra_dracut_settings.yml with a failure scenario for
nbde_client_extra_dracut_settings, passing an invalid value such as a dictionary
instead of a list of strings and asserting that role execution fails. Preserve
the existing success and idempotency checks.
Source: Path instructions
|
[citest] |
Feature: Introduce the nbde_client_extra_dracut_settings variable.
This is a list of strings written to
/etc/dracut.conf.d/nbde_client.conf in addition to the implicit
platform-specific __nbde_client_dracut_settings.
Reason: NBDE clients with static IP addressing need custom early-boot
network settings in dracut (for example kernel_cmdline with a static
ip= and nameserver). Previously the role only wrote fixed platform
settings, so users had to disable early boot or manage dracut config
outside the role.
Result: Users can pass extra dracut configuration lines via
nbde_client_extra_dracut_settings (documented in README.md) while
keeping the role's implicit settings. A new integration test verifies
the static IP kernel_cmdline example is written to the conf file.
Assisted-by: Cursor using models Cursor Grok 4.5, Composer 2.5, Sonnet 5
Signed-off-by: Rich Megginson rmeggins@redhat.com
Summary by CodeRabbit
New Features
Documentation
Tests