diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2019-11-08 14:06:33 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2019-11-08 14:06:33 -0800 |
commit | 8a7e29d52882c39d0c903eef83bd3472e4f334af (patch) | |
tree | a25a7b76416e07ebdb54e569fb0006079cf012db /lib/chef/knife.rb | |
parent | c31625406530b560fab02b11fa2447955ed2faef (diff) | |
download | chef-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/knife.rb')
-rw-r--r-- | lib/chef/knife.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb index bc25d48f90..e040de9d57 100644 --- a/lib/chef/knife.rb +++ b/lib/chef/knife.rb @@ -1,7 +1,7 @@ # # Author:: Adam Jacob (<adam@chef.io>) # Author:: Christopher Brown (<cb@chef.io>) -# Copyright:: Copyright 2009-2018, Chef Software Inc. +# Copyright:: Copyright 2009-2019, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,6 +20,7 @@ require "forwardable" unless defined?(Forwardable) require_relative "version" require "mixlib/cli" unless defined?(Mixlib::CLI) +require "chef-utils/dsl/path_sanity" unless defined?(ChefUtils::DSL::PathSanity) require_relative "workstation_config_loader" require_relative "mixin/convert_to_class_name" require_relative "mixin/path_sanity" @@ -39,7 +40,7 @@ class Chef Chef::HTTP::HTTPRequest.user_agent = "#{Chef::Dist::PRODUCT} Knife#{Chef::HTTP::HTTPRequest::UA_COMMON}" include Mixlib::CLI - include Chef::Mixin::PathSanity + include ChefUtils::DSL::PathSanity extend Chef::Mixin::ConvertToClassName extend Forwardable @@ -479,7 +480,7 @@ class Chef unless respond_to?(:run) ui.error "You need to add a #run method to your knife command before you can use it" end - enforce_path_sanity + ENV["PATH"] = sanitized_path if Chef::Config[:enforce_path_sanity] maybe_setup_fips Chef::LocalMode.with_server_connectivity do run |