summaryrefslogtreecommitdiff
path: root/lib/chef/provider
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/provider')
-rw-r--r--lib/chef/provider/directory.rb12
-rw-r--r--lib/chef/provider/file.rb4
-rw-r--r--lib/chef/provider/launchd.rb2
-rw-r--r--lib/chef/provider/link.rb4
-rw-r--r--lib/chef/provider/mount/linux.rb2
-rw-r--r--lib/chef/provider/mount/mount.rb6
-rw-r--r--lib/chef/provider/template.rb2
7 files changed, 16 insertions, 16 deletions
diff --git a/lib/chef/provider/directory.rb b/lib/chef/provider/directory.rb
index 555340d91e..6a20556ccd 100644
--- a/lib/chef/provider/directory.rb
+++ b/lib/chef/provider/directory.rb
@@ -32,7 +32,7 @@ class Chef
def load_current_resource
@current_resource = Chef::Resource::Directory.new(new_resource.name)
current_resource.path(new_resource.path)
- if ::File.exists?(current_resource.path) && @action != :create_if_missing
+ if ::File.exist?(current_resource.path) && @action != :create_if_missing
load_resource_attributes_from_file(current_resource)
end
current_resource
@@ -73,7 +73,7 @@ class Chef
# make sure we have write permissions to that directory
is_parent_writable = lambda do |base_dir|
base_dir = ::File.dirname(base_dir)
- if ::File.exists?(base_dir)
+ if ::File.exist?(base_dir)
if Chef::FileAccessControl.writable?(base_dir)
true
elsif Chef::Util::PathHelper.is_sip_path?(base_dir, node)
@@ -89,7 +89,7 @@ class Chef
else
# in why run mode & parent directory does not exist no permissions check is required
# If not in why run, permissions must be valid and we rely on prior assertion that dir exists
- if !whyrun_mode? || ::File.exists?(parent_directory)
+ if !whyrun_mode? || ::File.exist?(parent_directory)
if Chef::FileAccessControl.writable?(parent_directory)
true
elsif Chef::Util::PathHelper.is_sip_path?(parent_directory, node)
@@ -108,7 +108,7 @@ class Chef
requirements.assert(:delete) do |a|
a.assertion do
- if ::File.exists?(new_resource.path)
+ if ::File.exist?(new_resource.path)
::File.directory?(new_resource.path) && Chef::FileAccessControl.writable?(new_resource.path)
else
true
@@ -122,7 +122,7 @@ class Chef
end
action :create do
- unless ::File.exists?(new_resource.path)
+ unless ::File.exist?(new_resource.path)
converge_by("create new directory #{new_resource.path}") do
if new_resource.recursive == true
::FileUtils.mkdir_p(new_resource.path)
@@ -138,7 +138,7 @@ class Chef
end
action :delete do
- if ::File.exists?(new_resource.path)
+ if ::File.exist?(new_resource.path)
converge_by("delete existing directory #{new_resource.path}") do
if new_resource.recursive == true
# we don't use rm_rf here because it masks all errors, including
diff --git a/lib/chef/provider/file.rb b/lib/chef/provider/file.rb
index e2c07ad9f7..b4d659b4e8 100644
--- a/lib/chef/provider/file.rb
+++ b/lib/chef/provider/file.rb
@@ -157,7 +157,7 @@ class Chef
end
action :delete do
- if ::File.exists?(new_resource.path)
+ if ::File.exist?(new_resource.path)
converge_by("delete file #{new_resource.path}") do
do_backup unless file_class.symlink?(new_resource.path)
::File.delete(new_resource.path)
@@ -393,7 +393,7 @@ class Chef
# a nil tempfile is okay, means the resource has no content or no new content
return if tempfile.nil?
# but a tempfile that has no path or doesn't exist should not happen
- if tempfile.path.nil? || !::File.exists?(tempfile.path)
+ if tempfile.path.nil? || !::File.exist?(tempfile.path)
raise "#{ChefUtils::Dist::Infra::CLIENT} is confused, trying to deploy a file that has no path or does not exist..."
end
diff --git a/lib/chef/provider/launchd.rb b/lib/chef/provider/launchd.rb
index b8ff9dfa4d..73380fc83b 100644
--- a/lib/chef/provider/launchd.rb
+++ b/lib/chef/provider/launchd.rb
@@ -52,7 +52,7 @@ class Chef
end
action :delete do
- if ::File.exists?(path)
+ if ::File.exist?(path)
manage_service(:disable)
end
manage_plist(:delete)
diff --git a/lib/chef/provider/link.rb b/lib/chef/provider/link.rb
index 900d0516af..63582b462a 100644
--- a/lib/chef/provider/link.rb
+++ b/lib/chef/provider/link.rb
@@ -43,8 +43,8 @@ class Chef
)
else
current_resource.link_type(:hard)
- if ::File.exists?(current_resource.target_file)
- if ::File.exists?(new_resource.to) &&
+ if ::File.exist?(current_resource.target_file)
+ if ::File.exist?(new_resource.to) &&
file_class.stat(current_resource.target_file).ino ==
file_class.stat(new_resource.to).ino
current_resource.to(canonicalize(new_resource.to))
diff --git a/lib/chef/provider/mount/linux.rb b/lib/chef/provider/mount/linux.rb
index 382e37d41a..a57d16a12b 100644
--- a/lib/chef/provider/mount/linux.rb
+++ b/lib/chef/provider/mount/linux.rb
@@ -33,7 +33,7 @@ class Chef
def mounted?
mounted = false
- real_mount_point = if ::File.exists? @new_resource.mount_point
+ real_mount_point = if ::File.exist? @new_resource.mount_point
::File.realpath(@new_resource.mount_point)
else
@new_resource.mount_point
diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb
index 0bd81d5453..4fb626ca60 100644
--- a/lib/chef/provider/mount/mount.rb
+++ b/lib/chef/provider/mount/mount.rb
@@ -42,9 +42,9 @@ class Chef
def mountable?
# only check for existence of non-remote devices
- if device_should_exist? && !::File.exists?(device_real)
+ if device_should_exist? && !::File.exist?(device_real)
raise Chef::Exceptions::Mount, "Device #{@new_resource.device} does not exist"
- elsif @new_resource.mount_point != "none" && !::File.exists?(@new_resource.mount_point)
+ elsif @new_resource.mount_point != "none" && !::File.exist?(@new_resource.mount_point)
raise Chef::Exceptions::Mount, "Mount point #{@new_resource.mount_point} does not exist"
end
@@ -81,7 +81,7 @@ class Chef
# "mount" outputs the mount points as real paths. Convert
# the mount_point of the resource to a real path in case it
# contains symlinks in its parents dirs.
- real_mount_point = if ::File.exists? @new_resource.mount_point
+ real_mount_point = if ::File.exist? @new_resource.mount_point
::File.realpath(@new_resource.mount_point)
else
@new_resource.mount_point
diff --git a/lib/chef/provider/template.rb b/lib/chef/provider/template.rb
index 6662821aae..307dad7b7b 100644
--- a/lib/chef/provider/template.rb
+++ b/lib/chef/provider/template.rb
@@ -39,7 +39,7 @@ class Chef
super
requirements.assert(:create, :create_if_missing) do |a|
- a.assertion { ::File.exists?(content.template_location) }
+ a.assertion { ::File.exist?(content.template_location) }
a.failure_message "Template source #{content.template_location} could not be found."
a.whyrun "Template source #{content.template_location} does not exist. Assuming it would have been created."
a.block_action!