summaryrefslogtreecommitdiff
path: root/lib/chef/client.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-11-08 14:06:33 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2019-11-08 14:06:33 -0800
commit8a7e29d52882c39d0c903eef83bd3472e4f334af (patch)
treea25a7b76416e07ebdb54e569fb0006079cf012db /lib/chef/client.rb
parentc31625406530b560fab02b11fa2447955ed2faef (diff)
downloadchef-8a7e29d52882c39d0c903eef83bd3472e4f334af.tar.gz
Add chef-utils gem with various recipe DSL helpers
This is the implementation of [RFC-087](https://github.com/chef-boneyard/chef-rfc/blob/master/rfc087-distro-sugar-helpers.md) although some of the specifics have been iterated on and changed. The documentation will be in the [README.md](https://github.com/chef/chef/tree/master/chef-utils/README.md) once this is merged. While this PR mostly moves chef-sugar utilities into core-chef via this chef-utils gem, the scope of the chef-utils gem should be considered larger than just that. As an example this PR moves the Mash class into this gem for reuse in ohai as well. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/client.rb')
-rw-r--r--lib/chef/client.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index 06370f5d07..9e1859eba8 100644
--- a/lib/chef/client.rb
+++ b/lib/chef/client.rb
@@ -20,7 +20,7 @@
require_relative "config"
require_relative "mixin/params_validate"
-require_relative "mixin/path_sanity"
+require "chef-utils/dsl/path_sanity" unless defined?(ChefUtils::DSL::PathSanity)
require_relative "log"
require_relative "deprecated"
require_relative "server_api"
@@ -52,6 +52,7 @@ require_relative "policy_builder"
require_relative "request_id"
require_relative "platform/rebooter"
require_relative "mixin/deprecation"
+require "chef-utils" unless defined?(ChefUtils::CANARY)
require "ohai" unless defined?(Ohai::System)
require "rbconfig"
require_relative "dist"
@@ -62,8 +63,6 @@ class Chef
# The main object in a Chef run. Preps a Chef::Node and Chef::RunContext,
# syncs cookbooks if necessary, and triggers convergence.
class Client
- include Chef::Mixin::PathSanity
-
extend Chef::Mixin::Deprecation
extend Forwardable
@@ -251,7 +250,7 @@ class Chef
logger.info "#{Chef::Dist::CLIENT.capitalize} pid: #{Process.pid}"
logger.info "Targeting node: #{Chef::Config.target_mode.host}" if Chef::Config.target_mode?
logger.debug("#{Chef::Dist::CLIENT.capitalize} request_id: #{request_id}")
- enforce_path_sanity
+ ENV["PATH"] = ChefUtils::PathSanity.sanitized_path if Chef::Config[:enforce_path_sanity]
if Chef::Config.target_mode?
get_ohai_data_remotely
@@ -749,7 +748,7 @@ class Chef
# @api private
#
def do_windows_admin_check
- if Chef::Platform.windows?
+ if ChefUtils.windows?
logger.trace("Checking for administrator privileges....")
if !has_admin_privileges?