Skip to content

Commit

Permalink
Merge pull request #17 from jjo93sa/feat/handle-empty-list-items
Browse files Browse the repository at this point in the history
Handle empty list items
  • Loading branch information
markgoddard authored Jan 23, 2024
2 parents 48bc248 + 2cb415a commit ccba8be
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions roles/grubcmdline/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
- name: Set fact containing GRUB_CMDLINE_LINUX_DEFAULT
ansible.builtin.set_fact:
grub_cmdline_linux_default: >-
{{ grub_result.content | b64decode | regex_search('^GRUB_CMDLINE_LINUX_DEFAULT.*$', multiline=True)
| regex_replace('^GRUB_CMDLINE_LINUX_DEFAULT="(.*)"$', '\1') }}
{{ grub_result.content | b64decode | regex_search('^GRUB_CMDLINE_LINUX_DEFAULT.*$', multiline=True) | regex_replace('^GRUB_CMDLINE_LINUX_DEFAULT="(.*)"$', '\1') }}
- name: Display GRUB_CMDLINE_DEFAULT
ansible.builtin.debug:
var: grub_cmdline_linux_default
Expand All @@ -42,7 +40,7 @@

- name: Updated kernel cmd line params
ansible.builtin.set_fact:
grub_cmdline_linux_new: "{{ grub_cmdline_linux_default.split() | difference(grub_cmdline_linux_remove) + kernel_cmdline }}"
grub_cmdline_linux_new: "{{ grub_cmdline_linux_default.split() | difference(grub_cmdline_linux_remove) + kernel_cmdline | select() }}"

- name: Display newly computed GRUB_CMDLINE_DEFAULT
ansible.builtin.debug:
Expand Down

0 comments on commit ccba8be

Please sign in to comment.