puppet-prod/modules/zfs/lib/facter/zfs_zpool_cache_present.rb
Ben Vincent 766233c3e5 fix: check if zfs-cache exists and isnt empty (#409)
- check the cache file exists, and isnt empty
- resolves idempotence for zpool-import-cache service

Reviewed-on: #409
2025-10-18 21:15:55 +11:00

16 lines
299 B
Ruby

# frozen_string_literal: true
Facter.add('zfs_zpool_cache_present') do
confine kernel: 'Linux'
setcode do
cache_file = '/etc/zfs/zpool.cache'
File.exist?(cache_file) && File.size(cache_file).positive?
end
end
Facter.add('zfs_zpool_cache_present') do
setcode do
false
end
end