summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/client.rb4
-rw-r--r--lib/chef/cookbook/cookbook_version_loader.rb6
-rw-r--r--lib/chef/cookbook_version.rb2
-rw-r--r--lib/chef/dsl/reboot_pending.rb2
-rw-r--r--lib/chef/file_access_control/windows.rb8
-rw-r--r--lib/chef/file_cache.rb8
-rw-r--r--lib/chef/formatters/error_inspectors/resource_failure_inspector.rb2
-rw-r--r--lib/chef/handler/json_file.rb2
-rw-r--r--lib/chef/http/ssl_policies.rb4
-rw-r--r--lib/chef/node.rb2
-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
17 files changed, 36 insertions, 36 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index 099c061a96..ff2f310130 100644
--- a/lib/chef/client.rb
+++ b/lib/chef/client.rb
@@ -638,7 +638,7 @@ class Chef
if !config[:client_key]
events.skipping_registration(client_name, config)
logger.trace("Client key is unspecified - skipping registration")
- elsif File.exists?(config[:client_key])
+ elsif File.exist?(config[:client_key])
events.skipping_registration(client_name, config)
logger.trace("Client key #{config[:client_key]} is present - skipping registration")
else
@@ -878,7 +878,7 @@ class Chef
end
def empty_directory?(path)
- !File.exists?(path) || (Dir.entries(path).size <= 2)
+ !File.exist?(path) || (Dir.entries(path).size <= 2)
end
def is_last_element?(index, object)
diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb
index faed509321..00cf22e6da 100644
--- a/lib/chef/cookbook/cookbook_version_loader.rb
+++ b/lib/chef/cookbook/cookbook_version_loader.rb
@@ -160,13 +160,13 @@ class Chef
def metadata_filenames
return @metadata_filenames unless @metadata_filenames.empty?
- if File.exists?(File.join(cookbook_path, UPLOADED_COOKBOOK_VERSION_FILE))
+ if File.exist?(File.join(cookbook_path, UPLOADED_COOKBOOK_VERSION_FILE))
@uploaded_cookbook_version_file = File.join(cookbook_path, UPLOADED_COOKBOOK_VERSION_FILE)
end
- if File.exists?(File.join(cookbook_path, "metadata.json"))
+ if File.exist?(File.join(cookbook_path, "metadata.json"))
@metadata_filenames << File.join(cookbook_path, "metadata.json")
- elsif File.exists?(File.join(cookbook_path, "metadata.rb"))
+ elsif File.exist?(File.join(cookbook_path, "metadata.rb"))
@metadata_filenames << File.join(cookbook_path, "metadata.rb")
elsif uploaded_cookbook_version_file
@metadata_filenames << uploaded_cookbook_version_file
diff --git a/lib/chef/cookbook_version.rb b/lib/chef/cookbook_version.rb
index 420532585a..f6f5c12974 100644
--- a/lib/chef/cookbook_version.rb
+++ b/lib/chef/cookbook_version.rb
@@ -471,7 +471,7 @@ class Chef
end
def reload_metadata!
- if File.exists?(metadata_json_file)
+ if File.exist?(metadata_json_file)
metadata.from_json(IO.read(metadata_json_file))
end
end
diff --git a/lib/chef/dsl/reboot_pending.rb b/lib/chef/dsl/reboot_pending.rb
index 19d3a6b0bd..5a6f8ee219 100644
--- a/lib/chef/dsl/reboot_pending.rb
+++ b/lib/chef/dsl/reboot_pending.rb
@@ -47,7 +47,7 @@ class Chef
registry_key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending')
elsif platform?("ubuntu")
# This should work for Debian as well if update-notifier-common happens to be installed. We need an API for that.
- File.exists?("/var/run/reboot-required")
+ File.exist?("/var/run/reboot-required")
else
false
end
diff --git a/lib/chef/file_access_control/windows.rb b/lib/chef/file_access_control/windows.rb
index cc1b96a84d..744c5f7466 100644
--- a/lib/chef/file_access_control/windows.rb
+++ b/lib/chef/file_access_control/windows.rb
@@ -33,7 +33,7 @@ class Chef
module ClassMethods
# We want to mix these in as class methods
def writable?(path)
- ::File.exists?(path) && Chef::ReservedNames::Win32::File.file_access_check(
+ ::File.exist?(path) && Chef::ReservedNames::Win32::File.file_access_check(
path, Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_WRITE
)
end
@@ -136,7 +136,7 @@ class Chef
end
def should_update_dacl?
- return true unless ::File.exists?(file) || ::File.symlink?(file)
+ return true unless ::File.exist?(file) || ::File.symlink?(file)
dacl = target_dacl
existing_dacl = existing_descriptor.dacl
@@ -170,7 +170,7 @@ class Chef
end
def should_update_group?
- return true unless ::File.exists?(file) || ::File.symlink?(file)
+ return true unless ::File.exist?(file) || ::File.symlink?(file)
(group = target_group) && (group != existing_descriptor.group)
end
@@ -190,7 +190,7 @@ class Chef
end
def should_update_owner?
- return true unless ::File.exists?(file) || ::File.symlink?(file)
+ return true unless ::File.exist?(file) || ::File.symlink?(file)
(owner = target_owner) && (owner != existing_descriptor.owner)
end
diff --git a/lib/chef/file_cache.rb b/lib/chef/file_cache.rb
index 22060869da..851234596a 100644
--- a/lib/chef/file_cache.rb
+++ b/lib/chef/file_cache.rb
@@ -79,7 +79,7 @@ class Chef
file_path_array = File.split(path)
file_name = file_path_array.pop
- if File.exists?(file) && File.writable?(file)
+ if File.exist?(file) && File.writable?(file)
FileUtils.mv(
file,
File.join(create_cache_path(File.join(file_path_array), true), file_name)
@@ -112,7 +112,7 @@ class Chef
}
)
cache_path = create_cache_path(path, false)
- raise Chef::Exceptions::FileNotFound, "Cannot find #{cache_path} for #{path}!" unless File.exists?(cache_path)
+ raise Chef::Exceptions::FileNotFound, "Cannot find #{cache_path} for #{path}!" unless File.exist?(cache_path)
if read
File.read(cache_path)
@@ -139,7 +139,7 @@ class Chef
}
)
cache_path = create_cache_path(path, false)
- if File.exists?(cache_path)
+ if File.exist?(cache_path)
File.unlink(cache_path)
end
true
@@ -186,7 +186,7 @@ class Chef
}
)
full_path = create_cache_path(path, false)
- if File.exists?(full_path)
+ if File.exist?(full_path)
true
else
false
diff --git a/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb b/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb
index 905a438f56..8ddae24e6d 100644
--- a/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb
+++ b/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb
@@ -66,7 +66,7 @@ class Chef
@snippet ||= begin
if (file = parse_source) && (line = parse_line(file))
- return nil unless ::File.exists?(file)
+ return nil unless ::File.exist?(file)
lines = IO.readlines(file)
diff --git a/lib/chef/handler/json_file.rb b/lib/chef/handler/json_file.rb
index 6318c30d74..998f2b0e0e 100644
--- a/lib/chef/handler/json_file.rb
+++ b/lib/chef/handler/json_file.rb
@@ -51,7 +51,7 @@ class Chef
end
def build_report_dir
- unless File.exists?(config[:path])
+ unless File.exist?(config[:path])
FileUtils.mkdir_p(config[:path])
File.chmod(00700, config[:path])
end
diff --git a/lib/chef/http/ssl_policies.rb b/lib/chef/http/ssl_policies.rb
index d03494defe..60a763d431 100644
--- a/lib/chef/http/ssl_policies.rb
+++ b/lib/chef/http/ssl_policies.rb
@@ -92,10 +92,10 @@ class Chef
unless config[:ssl_client_cert] && config[:ssl_client_key]
raise Chef::Exceptions::ConfigurationError, "You must configure ssl_client_cert and ssl_client_key together"
end
- unless ::File.exists?(config[:ssl_client_cert])
+ unless ::File.exist?(config[:ssl_client_cert])
raise Chef::Exceptions::ConfigurationError, "The configured ssl_client_cert #{config[:ssl_client_cert]} does not exist"
end
- unless ::File.exists?(config[:ssl_client_key])
+ unless ::File.exist?(config[:ssl_client_key])
raise Chef::Exceptions::ConfigurationError, "The configured ssl_client_key #{config[:ssl_client_key]} does not exist"
end
diff --git a/lib/chef/node.rb b/lib/chef/node.rb
index d569eeda38..50a861066b 100644
--- a/lib/chef/node.rb
+++ b/lib/chef/node.rb
@@ -761,7 +761,7 @@ class Chef
path = File.expand_path(Chef::Config[:chef_guid_path])
dir = File.dirname(path)
- unless File.exists?(path)
+ unless File.exist?(path)
FileUtils.mkdir_p(dir)
File.write(path, SecureRandom.uuid)
end
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!