From 1375e7db7c4f1c112ce2dd8db942fb1405a7d5a4 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sat, 18 Oct 2025 20:44:06 +1100 Subject: [PATCH] fix: check if zfs-cache exists and isnt empty - check the cache file exists, and isnt empty - resolves idempotence for zpool-import-cache service --- 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