Skip to content

Commit

Permalink
fix: use stat.pw_name, stat.gr_name instead of owner, group
Browse files Browse the repository at this point in the history
Cause: The fields `stat.owner` and `stat.group` do not exist.

Consequence: The crypttab was always being set to owner/group root.

Fix: Use the correct fields `stat.pw_name` and `stat.gr_name`.

Result: Owner and group of crypttab are preserved.

See https://docs.ansible.com/ansible/2.9/modules/stat_module.html#return-stat/gr_name

Signed-off-by: Rich Megginson <[email protected]>
  • Loading branch information
richm committed Aug 17, 2023
1 parent 12915cb commit 6bbbca7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tasks/main-blivet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@
state: "{{ entry.state }}"
create: true
mode: "{{ __storage_crypttab.stat.mode | d('0600') }}"
owner: "{{ __storage_crypttab.stat.owner | d('root') }}"
group: "{{ __storage_crypttab.stat.group | d('root') }}"
owner: "{{ __storage_crypttab.stat.pw_name | d('root') }}"
group: "{{ __storage_crypttab.stat.gr_name | d('root') }}"
loop: "{{ blivet_output.crypts }}"
loop_control:
loop_var: entry
Expand Down
15 changes: 15 additions & 0 deletions tests/tests_raid_volume_cleanup_nvme_generated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
# This file was generated by generate_tests.py
- name: Run test tests_raid_volume_cleanup.yml for nvme
hosts: all
tags:
- tests::nvme
tasks:
- name: Set disk interface for test
set_fact:
storage_test_use_interface: "nvme"

- name: Import playbook
import_playbook: tests_raid_volume_cleanup.yml
tags:
- tests::nvme
15 changes: 15 additions & 0 deletions tests/tests_raid_volume_cleanup_scsi_generated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
# This file was generated by generate_tests.py
- name: Run test tests_raid_volume_cleanup.yml for scsi
hosts: all
tags:
- tests::scsi
tasks:
- name: Set disk interface for test
set_fact:
storage_test_use_interface: "scsi"

- name: Import playbook
import_playbook: tests_raid_volume_cleanup.yml
tags:
- tests::scsi

0 comments on commit 6bbbca7

Please sign in to comment.