diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-08-11 13:30:10 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-08-12 14:02:34 -0700 |
commit | 4848c89b7cc5e4a4d4fac7c8bff962f7df69f719 (patch) | |
tree | cf1bc6d0b30f226573da88158049f1334b6ce1bd /lib/chef/provider/service | |
parent | 798cac61accc035b51aaac25160bf1d5e9715252 (diff) | |
download | chef-4848c89b7cc5e4a4d4fac7c8bff962f7df69f719.tar.gz |
File.exists? -> File.exist?exist
Update some of these methods
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/provider/service')
-rw-r--r-- | lib/chef/provider/service/arch.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/service/debian.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/service/gentoo.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/service/macosx.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/service/openbsd.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/service/redhat.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/service/upstart.rb | 2 |
7 files changed, 10 insertions, 10 deletions
diff --git a/lib/chef/provider/service/arch.rb b/lib/chef/provider/service/arch.rb index fe09baf2d5..400da506b1 100644 --- a/lib/chef/provider/service/arch.rb +++ b/lib/chef/provider/service/arch.rb @@ -32,7 +32,7 @@ class Chef::Provider::Service::Arch < Chef::Provider::Service::Init end def load_current_resource - raise Chef::Exceptions::Service, "Could not find /etc/rc.conf" unless ::File.exists?("/etc/rc.conf") + raise Chef::Exceptions::Service, "Could not find /etc/rc.conf" unless ::File.exist?("/etc/rc.conf") raise Chef::Exceptions::Service, "No DAEMONS found in /etc/rc.conf" unless /DAEMONS=\((.*)\)/m.match?(::File.read("/etc/rc.conf")) super diff --git a/lib/chef/provider/service/debian.rb b/lib/chef/provider/service/debian.rb index a89907bb50..da599fa2f6 100644 --- a/lib/chef/provider/service/debian.rb +++ b/lib/chef/provider/service/debian.rb @@ -45,7 +45,7 @@ class Chef shared_resource_requirements requirements.assert(:all_actions) do |a| update_rcd = "/usr/sbin/update-rc.d" - a.assertion { ::File.exists? update_rcd } + a.assertion { ::File.exist? update_rcd } a.failure_message Chef::Exceptions::Service, "#{update_rcd} does not exist!" # no whyrun recovery - this is a base system component of debian # distros and must be present diff --git a/lib/chef/provider/service/gentoo.rb b/lib/chef/provider/service/gentoo.rb index 748038cdaf..4678435129 100644 --- a/lib/chef/provider/service/gentoo.rb +++ b/lib/chef/provider/service/gentoo.rb @@ -34,7 +34,7 @@ class Chef::Provider::Service::Gentoo < Chef::Provider::Service::Init @current_resource.enabled( Dir.glob("/etc/runlevels/**/#{Chef::Util::PathHelper.escape_glob_dir(@current_resource.service_name)}").any? do |file| @found_script = true - exists = ::File.exists? file + exists = ::File.exist? file readable = ::File.readable? file logger.trace "#{@new_resource} exists: #{exists}, readable: #{readable}" exists && readable @@ -47,7 +47,7 @@ class Chef::Provider::Service::Gentoo < Chef::Provider::Service::Init def define_resource_requirements requirements.assert(:all_actions) do |a| - a.assertion { ::File.exists?("/sbin/rc-update") } + a.assertion { ::File.exist?("/sbin/rc-update") } a.failure_message Chef::Exceptions::Service, "/sbin/rc-update does not exist" # no whyrun recovery -t his is a core component whose presence is # unlikely to be affected by what we do in the course of a chef run diff --git a/lib/chef/provider/service/macosx.rb b/lib/chef/provider/service/macosx.rb index a2f8f15b7b..7e695aaf2b 100644 --- a/lib/chef/provider/service/macosx.rb +++ b/lib/chef/provider/service/macosx.rb @@ -81,7 +81,7 @@ class Chef end requirements.assert(:all_actions) do |a| - a.assertion { ::File.exists?(@plist.to_s) } + a.assertion { ::File.exist?(@plist.to_s) } a.failure_message Chef::Exceptions::Service, "Could not find plist for #{@new_resource}" end @@ -221,7 +221,7 @@ class Chef return nil if @plist.nil? # Plist must exist by this point - raise Chef::Exceptions::FileNotFound, "Cannot find #{@plist}!" unless ::File.exists?(@plist) + raise Chef::Exceptions::FileNotFound, "Cannot find #{@plist}!" unless ::File.exist?(@plist) # Most services have the same internal label as the name of the # plist file. However, there is no rule saying that *has* to be diff --git a/lib/chef/provider/service/openbsd.rb b/lib/chef/provider/service/openbsd.rb index 99e8cff6aa..2b484f9fc8 100644 --- a/lib/chef/provider/service/openbsd.rb +++ b/lib/chef/provider/service/openbsd.rb @@ -129,7 +129,7 @@ class Chef end def update_rcl(value) - FileUtils.touch RC_CONF_LOCAL_PATH unless ::File.exists? RC_CONF_LOCAL_PATH + FileUtils.touch RC_CONF_LOCAL_PATH unless ::File.exist? RC_CONF_LOCAL_PATH ::File.write(RC_CONF_LOCAL_PATH, value) @rc_conf_local = value end diff --git a/lib/chef/provider/service/redhat.rb b/lib/chef/provider/service/redhat.rb index ec78ef2240..3ef7110002 100644 --- a/lib/chef/provider/service/redhat.rb +++ b/lib/chef/provider/service/redhat.rb @@ -56,7 +56,7 @@ class Chef requirements.assert(:all_actions) do |a| chkconfig_file = "/sbin/chkconfig" - a.assertion { ::File.exists? chkconfig_file } + a.assertion { ::File.exist? chkconfig_file } a.failure_message Chef::Exceptions::Service, "#{chkconfig_file} does not exist!" end @@ -80,7 +80,7 @@ class Chef super - if ::File.exists?("/sbin/chkconfig") + if ::File.exist?("/sbin/chkconfig") chkconfig = shell_out!("/sbin/chkconfig --list #{current_resource.service_name}", returns: [0, 1]) unless run_levels.nil? || run_levels.empty? all_levels_match = true diff --git a/lib/chef/provider/service/upstart.rb b/lib/chef/provider/service/upstart.rb index 5b93e6f5a9..2b9e304160 100644 --- a/lib/chef/provider/service/upstart.rb +++ b/lib/chef/provider/service/upstart.rb @@ -135,7 +135,7 @@ class Chef end end # Get enabled/disabled state by reading job configuration file - if ::File.exists?("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}") + if ::File.exist?("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}") logger.trace("#{@new_resource} found #{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}") ::File.open("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}", "r") do |file| while line = file.gets |