-
Notifications
You must be signed in to change notification settings - Fork 23
feat: Support extra dracut settings for static IP #268
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| # nbde_client dracut config | ||
| {{ ansible_managed | comment }} | ||
| {{ "system_role:nbde_client" | comment(prefix="", postfix="") }} | ||
| {% for line in __nbde_client_dracut_settings %} | ||
| {% for line in __nbde_client_dracut_settings + nbde_client_extra_dracut_settings %} | ||
| {{ line }} | ||
| {% endfor %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # Generated by: Cursor using models Cursor Grok 4.5, Composer 2.5, Sonnet 5 | ||
| --- | ||
| - name: Test nbde_client_extra_dracut_settings | ||
| hosts: all | ||
| vars: | ||
| __nbde_client_test_extra_dracut_line: >- | ||
| kernel_cmdline="ip=192.0.2.10::192.0.2.1:255.255.255.0::ens3:none nameserver=192.0.2.100" | ||
| 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 | ||
|
|
||
|
Comment on lines
+8
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win Align role invocations with path instructions.
(Note: Consider adding the 📍 Affects 1 file
🤖 Prompt for AI AgentsSource: Path instructions |
||
| - name: Read generated dracut config | ||
| slurp: | ||
| src: /etc/dracut.conf.d/nbde_client.conf | ||
| register: __nbde_client_dracut_conf | ||
|
|
||
| - name: Decode dracut config content | ||
| set_fact: | ||
| __nbde_client_dracut_conf_content: "{{ | ||
| __nbde_client_dracut_conf.content | b64decode }}" | ||
|
|
||
| - name: Verify extra dracut setting is present | ||
| assert: | ||
| that: | ||
| - __nbde_client_test_extra_dracut_line in | ||
| __nbde_client_dracut_conf_content | ||
| fail_msg: >- | ||
| Expected /etc/dracut.conf.d/nbde_client.conf to contain | ||
| {{ __nbde_client_test_extra_dracut_line }}. Content was: | ||
| {{ __nbde_client_dracut_conf_content }} | ||
|
|
||
| - name: Verify implicit dracut settings are present | ||
| assert: | ||
| that: | ||
| - item in __nbde_client_dracut_conf_content | ||
| fail_msg: >- | ||
| Expected /etc/dracut.conf.d/nbde_client.conf to contain | ||
| implicit setting {{ item }}. Content was: | ||
| {{ __nbde_client_dracut_conf_content }} | ||
| loop: "{{ __nbde_client_dracut_settings }}" | ||
|
|
||
| - name: Use nbde_client role again for idempotency | ||
| include_tasks: tasks/run_role_with_clear_facts.yml | ||
| vars: | ||
| __sr_public: true | ||
|
|
||
| - name: Re-read generated dracut config | ||
| slurp: | ||
| src: /etc/dracut.conf.d/nbde_client.conf | ||
| register: __nbde_client_dracut_conf_again | ||
|
|
||
| - name: Verify dracut config is unchanged after second run | ||
| assert: | ||
| that: | ||
| - __nbde_client_dracut_conf.content == | ||
| __nbde_client_dracut_conf_again.content | ||
| fail_msg: Dracut config changed on second role run | ||
|
|
||
| always: | ||
| - name: Clean up generated dracut config | ||
| file: | ||
| path: /etc/dracut.conf.d/nbde_client.conf | ||
| state: absent | ||
| tags: | ||
| - tests::cleanup | ||
|
|
||
| # vim:set ts=2 sw=2 et: | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 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_settingsand asserting that the role execution fails).🤖 Prompt for AI Agents
Source: Path instructions