From 766233c3e5e8929dc4dd647572c1eb067fa72d86 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sat, 18 Oct 2025 21:15:55 +1100 Subject: [PATCH] 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: https://git.unkin.net/unkin/puppet-prod/pulls/409 --- modules/zfs/lib/facter/zfs_zpool_cache_present.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/zfs/lib/facter/zfs_zpool_cache_present.rb b/modules/zfs/lib/facter/zfs_zpool_cache_present.rb index d2e87fe..0196d54 100644 --- a/modules/zfs/lib/facter/zfs_zpool_cache_present.rb +++ b/modules/zfs/lib/facter/zfs_zpool_cache_present.rb @@ -3,7 +3,8 @@ Facter.add('zfs_zpool_cache_present') do confine kernel: 'Linux' setcode do - File.exist?('/etc/zfs/zpool.cache') + cache_file = '/etc/zfs/zpool.cache' + File.exist?(cache_file) && File.size(cache_file).positive? end end