diff --git a/lib/resources/file.rb b/lib/resources/file.rb index d0ce82bd8..e399a5d09 100644 --- a/lib/resources/file.rb +++ b/lib/resources/file.rb @@ -12,7 +12,7 @@ module Vulcano::Resources end %w{ - type exists? file? block_device? character_device? socket? directory? + type exist? file? block_device? character_device? socket? directory? symlink? pipe? mode mode? owner owned_by? group grouped_into? link_target linked_to? content mtime size selinux_label mounted? immutable? product_version file_version version? md5sum sha256sum diff --git a/lib/vulcano/backend/local.rb b/lib/vulcano/backend/local.rb index 9ea63efab..fe165257b 100644 --- a/lib/vulcano/backend/local.rb +++ b/lib/vulcano/backend/local.rb @@ -96,7 +96,7 @@ module Vulcano::Backends end %w{ - exists? file? socket? directory? symlink? pipe? + exist? file? socket? directory? symlink? pipe? }.each do |m| define_method m.to_sym do ::File.method(m.to_sym).call(@path) diff --git a/lib/vulcano/backend/mock.rb b/lib/vulcano/backend/mock.rb index f6d442a11..4e542432d 100644 --- a/lib/vulcano/backend/mock.rb +++ b/lib/vulcano/backend/mock.rb @@ -63,11 +63,11 @@ module Vulcano::Backends def initialize(_runtime, path) @path = path # mock dataset - @exists = (rand < 0.8) ? true : false - @is_file = (@exists && rand < 0.7) ? true : false + @exist = (rand < 0.8) ? true : false + @is_file = (@exist && rand < 0.7) ? true : false @size = 0 @content = '' - if @exists && @is_file + if @exist && @is_file @size = (rand**3 * 1000).to_i @size = 0 if rand < 0.2 end @@ -77,7 +77,7 @@ module Vulcano::Backends @content end - %w{ size content file? exists? }.each do |m| + %w{ size content file? exist? }.each do |m| define_method m.to_sym do instance_variable_get(m.sub('?', '').to_sym) end diff --git a/lib/vulcano/backend/specinfra.rb b/lib/vulcano/backend/specinfra.rb index a2642d908..1ef65b943 100644 --- a/lib/vulcano/backend/specinfra.rb +++ b/lib/vulcano/backend/specinfra.rb @@ -218,7 +218,7 @@ module Vulcano::Backends super(backend, path) end - def exists? + def exist? Specinfra::Runner.check_file_exists(@path) end diff --git a/lib/vulcano/plugins/backend_file_common.rb b/lib/vulcano/plugins/backend_file_common.rb index 97898c8f5..182451e3b 100644 --- a/lib/vulcano/plugins/backend_file_common.rb +++ b/lib/vulcano/plugins/backend_file_common.rb @@ -5,7 +5,7 @@ class Vulcano::Plugins::Backend # interface methods: these fields should be implemented by every # backend File %w{ - exists? mode owner group link_target content mtime size + exist? mode owner group link_target content mtime size selinux_label product_version file_version path }.each do |m| define_method m.to_sym do diff --git a/lib/vulcano/plugins/backend_linux_file.rb b/lib/vulcano/plugins/backend_linux_file.rb index 9d16be4a4..7347c0e6a 100644 --- a/lib/vulcano/plugins/backend_linux_file.rb +++ b/lib/vulcano/plugins/backend_linux_file.rb @@ -17,8 +17,8 @@ class Vulcano::Plugins::Backend "cat #{@spath} 2>/dev/null || echo -n").stdout end - def exists? - @exists ||= ( + def exist? + @exist ||= ( @backend. run_command("test -e #{@spath}"). exit_status == 0