Skip to content

Commit

Permalink
fix: Do not set default value for fs_label
Browse files Browse the repository at this point in the history
For existing devices we want to read the default value from the
device instead of trying to reset it to default/empty label when
the fs_label attribute is not set.

Related: #417
  • Loading branch information
vojtechtrefny committed Jan 25, 2024
1 parent 169e33d commit 4c67043
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
4 changes: 1 addition & 3 deletions library/blivet.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@
fs_label:
description: fs_label
type: str
default: ''
fs_type:
description: fs_type
type: str
Expand Down Expand Up @@ -216,7 +215,6 @@
fs_label:
description: fs_label
type: str
default: ''
fs_type:
description: fs_type
type: str
Expand Down Expand Up @@ -2091,7 +2089,7 @@ def run_module():
encryption_luks_version=dict(type='str'),
encryption_password=dict(type='str', no_log=True),
fs_create_options=dict(type='str'),
fs_label=dict(type='str', default=''),
fs_label=dict(type='str'),
fs_type=dict(type='str'),
mount_options=dict(type='str'),
mount_point=dict(type='str'),
Expand Down
4 changes: 2 additions & 2 deletions tests/tests_lvm_pool_shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
size: "{{ volume1_size }}"
mount_point: "{{ mount_location1 }}"
fs_type: gfs2
fs_create_options: -p lock_nolock
fs_create_options: -j 2 -t rhel9-1node:myfs
- name: Verify role results
include_tasks: verify-role-results.yml
Expand All @@ -147,7 +147,7 @@
size: "{{ volume1_size }}"
mount_point: "{{ mount_location1 }}"
fs_type: gfs2
fs_create_options: -p lock_nolock
fs_create_options: -j 2 -t rhel9-1node:myfs

- name: Verify role results
include_tasks: verify-role-results.yml
Expand Down
34 changes: 34 additions & 0 deletions tests/tests_volume_relabel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,40 @@
- name: Verify role results
include_tasks: verify-role-results.yml

- name: Relabel without explicitly setting the label
include_role:
name: linux-system-roles.storage
vars:
storage_volumes:
- name: test1
type: disk
mount_point: "{{ mount_location }}"
fs_type: ext4
disks: "{{ unused_disks }}"

- name: Check for default value
assert:
that: not blivet_output.changed
msg: "Volume relabeling doesn't preserve existing label."

- name: Verify role results
include_tasks: verify-role-results.yml

- name: Remove label
include_role:
name: linux-system-roles.storage
vars:
storage_volumes:
- name: test1
type: disk
mount_point: "{{ mount_location }}"
fs_type: ext4
disks: "{{ unused_disks }}"
fs_label: ""

- name: Verify role results
include_tasks: verify-role-results.yml

- name: Clean up
include_role:
name: linux-system-roles.storage
Expand Down

0 comments on commit 4c67043

Please sign in to comment.