summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-03-16 12:20:31 -0700
committerGitHub <noreply@github.com>2020-03-16 12:20:31 -0700
commit401bb86bb34b2e898415bfe966beb299a227ddce (patch)
tree8a6628d68e081d5dc70f75cfa18cc78a4f3298bc /lib/chef
parent9fcebbb93e3370face246949a7ecaef18d6291bf (diff)
parent4cdc815f8df1a8775a738bd79f62890adeae692a (diff)
downloadchef-401bb86bb34b2e898415bfe966beb299a227ddce.tar.gz
Merge pull request #9493 from chef/log_improvements
Pull in many of Zenspider's rspec improvements
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/application.rb2
-rw-r--r--lib/chef/cookbook/synchronizer.rb1
-rw-r--r--lib/chef/resource.rb9
3 files changed, 9 insertions, 3 deletions
diff --git a/lib/chef/application.rb b/lib/chef/application.rb
index 02d4a4bacb..9e92c4e8c6 100644
--- a/lib/chef/application.rb
+++ b/lib/chef/application.rb
@@ -19,7 +19,6 @@
require "pp" unless defined?(PP)
require "socket" unless defined?(Socket)
require_relative "config"
-require_relative "config_fetcher"
require_relative "exceptions"
require_relative "local_mode"
require_relative "log"
@@ -119,6 +118,7 @@ class Chef
# @api private (test injection)
def chef_configfetcher
+ require_relative "config_fetcher"
Chef::ConfigFetcher
end
diff --git a/lib/chef/cookbook/synchronizer.rb b/lib/chef/cookbook/synchronizer.rb
index b6bcd2c150..4a2940fb1f 100644
--- a/lib/chef/cookbook/synchronizer.rb
+++ b/lib/chef/cookbook/synchronizer.rb
@@ -47,6 +47,7 @@ class Chef
end
def reset!
+ @skip_removal = nil
@valid_cache_entries = {}
end
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index 4967a2a84d..5153dd4910 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -961,6 +961,8 @@ class Chef
@resource_name = nil
end
end
+
+ @resource_name = nil unless defined?(@resource_name)
@resource_name
end
@@ -973,7 +975,7 @@ class Chef
# @param flag [Boolean] value to set unified_mode to
# @return [Boolean] unified_mode value
def self.unified_mode(flag = nil)
- @unified_mode = Chef::Config[:resource_unified_mode_default] if @unified_mode.nil?
+ @unified_mode = Chef::Config[:resource_unified_mode_default] if !defined?(@unified_mode) || @unified_mode.nil?
@unified_mode = flag unless flag.nil?
!!@unified_mode
end
@@ -1018,7 +1020,7 @@ class Chef
self.allowed_actions |= @default_action
end
- if @default_action
+ if defined?(@default_action) && @default_action
@default_action
elsif superclass.respond_to?(:default_action)
superclass.default_action
@@ -1341,6 +1343,9 @@ class Chef
def self.provides(name, **options, &block)
name = name.to_sym
+ # quell warnings
+ @chef_version_for_provides = nil unless defined?(@chef_version_for_provides)
+
# deliberately do not go through the accessor here
@resource_name = name if resource_name.nil?