Class: Proxy::Onboard::BMC::SDRCache
- Inherits:
-
Object
- Object
- Proxy::Onboard::BMC::SDRCache
- Includes:
- Log, Util
- Defined in:
- lib/bmc/sdr_cache.rb
Instance Method Summary collapse
Instance Method Details
#delete ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/bmc/sdr_cache.rb', line 36 def delete errors = [] existing_possible_paths.each do |path| begin FileUtils.remove_entry_secure(path) rescue Errno::ENOENT next rescue SystemCallError => e errors << e next end end return { errors: errors } unless errors.empty? true end |
#existing_possible_paths ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/bmc/sdr_cache.rb', line 24 def existing_possible_paths paths = [] possible_paths.each do |path| paths << path if File.exist?(path) end paths end |
#possible_paths ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/bmc/sdr_cache.rb', line 13 def possible_paths paths = [] sdr_cache_directory = sdr_cache_directory_from_freeipmi_conf paths << sdr_cache_directory unless sdr_cache_directory.nil? etc = Etc.getpwuid(Process.uid) paths + [ "#{etc.dir}/.freeipmi/sdr-cache", "/tmp/.freeipmi-#{etc.name}/.freeipmi/sdr-cache" ] end |
#present? ⇒ Boolean
32 33 34 |
# File 'lib/bmc/sdr_cache.rb', line 32 def present? !existing_possible_paths.empty? end |