Blob Blame History Raw
From 54df2906528ddea38adaf5ee71860bdfb49af492 Mon Sep 17 00:00:00 2001
From: Joel Capitao <jcapitao@redhat.com>
Date: Tue, 17 May 2022 10:51:59 +0200
Subject: [PATCH] (FACT-3116) Ignore EROFS when deleting fact cache

When fact cache is placed in read only file system, deleting a file
fails with EROFS instead of EACCES .
---
 lib/facter/framework/core/cache_manager.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/facter/framework/core/cache_manager.rb b/lib/facter/framework/core/cache_manager.rb
index 100a7656a..d93020264 100644
--- a/lib/facter/framework/core/cache_manager.rb
+++ b/lib/facter/framework/core/cache_manager.rb
@@ -227,7 +227,7 @@ cache_format_version is incorrect!")
 
       begin
         File.delete(cache_file_name) if File.readable?(cache_file_name)
-      rescue Errno::EACCES => e
+      rescue Errno::EACCES, Errno::EROFS => e
         @log.warn("Could not delete cache: #{e.message}")
       end
     end
-- 
2.35.1