Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

Commit 1ca16ed

Browse files
Katherine BlackKatherine Black
authored andcommitted
Default to empty strings if FS type or FS version are undefined.
1 parent 8bf7a73 commit 1ca16ed

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

houndigrade/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,9 @@ def is_lvm(partitions):
587587
partition_info[partition] = properties
588588

589589
for partition, properties in partition_info.items():
590-
if properties.get("ID_FS_TYPE") == "LVM2_member":
590+
if properties.get("ID_FS_TYPE", "") == "LVM2_member":
591591
lvm_partitions.add(partition)
592-
if "LVM2" in properties.get("ID_FS_VERSION"):
592+
if "LVM2" in properties.get("ID_FS_VERSION", ""):
593593
lvm_partitions.add(partition)
594594

595595
return lvm_partitions

houndigrade/tests/test_cli.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,9 +1029,10 @@ def test_rhel_found_via_release_file_on_lvm(
10291029
PTUUID=98a48d3a
10301030
PTTYPE=dos
10311031
"""
1032-
mock_udevadm.return_value = """ID_FS_TYPE=LVM2_member
1033-
ID_FS_VERSION=LVM2 001
1034-
"""
1032+
mock_udevadm_output1 = """ID_FS_VERSION=LVM2 001\n"""
1033+
mock_udevadm_output2 = """ID_FS_TYPE=LVM2_member\n"""
1034+
1035+
mock_udevadm.side_effect = [mock_udevadm_output1, mock_udevadm_output2]
10351036
lv_path = "./dev/mapper/rhel_vg-rhel_lv"
10361037
mock_tail.return_value = [lv_path]
10371038
mock_subprocess_check_output.return_value = RPM_RESULT_NONE

0 commit comments

Comments
 (0)