config/puppet-manifests/src/modules/platform/lib/facter/is_primary_disk_rotational.rb
Dean Troyer 9b95aa0a35 StarlingX open source release updates
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-05-31 07:35:52 -07:00

7 lines
321 B
Ruby

require 'facter'
Facter.add(:is_primary_disk_rotational) do
rootfs_partition = Facter::Core::Execution.exec("df --output=source / | tail -1")
rootfs_device = Facter::Core::Execution.exec("basename #{rootfs_partition} | sed 's/[0-9]*$//;s/p[0-9]*$//'")
setcode "cat /sys/block/#{rootfs_device}/queue/rotational"
end