puppet-prod/modules/zfs/lib/facter/zfs_zpool_cache_present.rb
Ben Vincent 1375e7db7c
All checks were successful
Build / precommit (pull_request) Successful in 4m56s
fix: check if zfs-cache exists and isnt empty
- check the cache file exists, and isnt empty
- resolves idempotence for zpool-import-cache service
2025-10-18 20:44:06 +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