-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add type GUIDs to partitions resolver #2745
Conversation
I still need to add tests and make sure that |
lib/facter/resolvers/partitions.rb
Outdated
return {} if lsblk_version < 2.23 | ||
|
||
# lsblk 2.25 added support for GPT partition type GUIDs | ||
blkid_and_lsblk[:lsblk] ||= if lsblk_version >= 2.25 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might it be easier to run lsblk
with the longer args and rescue
if it errors out?
b2abca0
to
45ee919
Compare
Closing and reopening to grab latest tests. |
Ruby 2.4 introduced the compact method to drop nil values from a Hash. Since Facter recommends Ruby 2.5 and above, we are able to replace more lengthy logic with Hash#compact instead.
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.
This commit adds a new fact to the partitions fact hash, partition type GUID. Co-authored-by: Michael Hashizume <[email protected]>
I've updated the branch protection rule to no longer require integration tests against JRuby 9.3.90 or 9.4.7.0 (these tests were updated in #2740) |
This PR adds partition type GUIDs to the partitions resolver.
In order to add this information, this PR also changes the partitions resolver to prefer
lsblk
overblkid
. Previously, Facter would useblkid
and fall back tolsblk
only ifblkid
did not return anything, for whatever reason. However, there are several reasons to preferlsblk
:lsblk
can return more information (like partition type GUIDs) thanblkid
.lsblk
does not have to necessarily run as root,blkid
does.blkid
's man page specifically recommend usinglsblk
: