summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc A. Paradise <marc.paradise@gmail.com>2019-04-17 14:45:34 -0400
committerMarc A. Paradise <marc.paradise@gmail.com>2019-04-24 13:29:00 -0400
commitbce2771afde3ab5fc3b381159cf8d926f7e27bb8 (patch)
tree76bc30b34f93bd440334b3e85e32f1e988ee0516
parenta6db21f6fe5d582f676ae86e6567269ab0dee5d6 (diff)
downloadchef-bce2771afde3ab5fc3b381159cf8d926f7e27bb8.tar.gz
Trailing code review
* document why chef_core/text is included at the top level. Signed-off-by: Marc A. Paradise <marc.paradise@gmail.com>
-rw-r--r--lib/chef.rb10
-rw-r--r--lib/chef/knife.rb1
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/chef.rb b/lib/chef.rb
index b103a097b0..c58f46debd 100644
--- a/lib/chef.rb
+++ b/lib/chef.rb
@@ -18,6 +18,16 @@
require "chef/version"
+# Ensure that this loads ahead of anything that
+# might cause rubygems to hit Gem.load_yaml, including
+# evaluating gemspecs. When load_yaml is invoked,
+# it stubs out the YAML::Syck namespace. This causes
+# r18n to break, which expects either YAML::Syck to be there
+# and fully defined (particularly, the Syck::PrivateType class),
+# or for it to not be there at all.
+#
+# When it's not - because it's a stub - r18n explodes on loading.
+# Ensuring chef_core/text and r18n are loaded first prevents this.
require "chef_core/text"
require "chef/nil_argument"
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb
index e5df72259d..aac0c8e258 100644
--- a/lib/chef/knife.rb
+++ b/lib/chef/knife.rb
@@ -368,7 +368,6 @@ class Chef
# Return where a config key has been sourced,
# :cli, :config, or nil if the key is not set.
-
def config_source(key)
return :cli if @key_sources[:cli].include? key
return :config if @key_sources[:config].include? key