Skip to content

Commit 57a281e

Browse files
committed
Prefer lsblk over blkid
Prior to this commit, the partitions resolver only used lsblk as a fallback if blkid did not return any information. However, there are many advantages to lsblk. lsblk does not necessarily require root (while blkid does), it returns more information (like partition type GUIDs), and blkid specifically recommends using lsblk in its manpage. This commit updates the partitions resolver to prefer lsblk and use blkid as a fallback.
1 parent 62119d1 commit 57a281e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/facter/resolvers/partitions.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ def populate_partitions(partition_name, block_path, blkid_and_lsblk, backing_fil
7373
end
7474

7575
def populate_from_syscalls(partition_name, blkid_and_lsblk)
76-
part_info = populate_from_blkid(partition_name, blkid_and_lsblk)
76+
# Prefer lsblk over blkid since lsblk does not require root, returns more information, and is recommended by blkid
77+
part_info = populate_from_lsblk(partition_name, blkid_and_lsblk)
7778

78-
return populate_from_lsblk(partition_name, blkid_and_lsblk) if part_info.empty?
79+
return populate_from_blkid(partition_name, blkid_and_lsblk) if part_info.empty?
7980

8081
part_info
8182
end

0 commit comments

Comments
 (0)