summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-09-07 13:37:47 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2016-09-07 13:37:47 -0700
commit335d1073eb8db7dbb25d2be308acabd318dc7dac (patch)
treec11c966d69a603e1a8c28873a1180beb89f96b51
parent4f202e8fa38a5d70c0ad524114751751c54276e8 (diff)
downloadchef-335d1073eb8db7dbb25d2be308acabd318dc7dac.tar.gz
also add a big comment to the Chef::Knife code
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/knife.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb
index 2d64798bda..c9ecfbf0cc 100644
--- a/lib/chef/knife.rb
+++ b/lib/chef/knife.rb
@@ -336,6 +336,12 @@ class Chef
# extracts the settings from the Chef::Config[:knife] sub-hash that correspond
# to knife cli options -- in preparation for merging config values with cli values
+ #
+ # NOTE: due to weirdness in mixlib-config #has_key? is only true if the value has
+ # been set by the user -- the Chef::Config defaults return #has_key?() of false and
+ # this code DEPENDS on that functionality since applying the default values in
+ # Chef::Config[:knife] would break the defaults in the cli that we would otherwise
+ # overwrite.
def config_file_settings
cli_keys.each_with_object({}) do |key, memo|
memo[key] = Chef::Config[:knife][key] if Chef::Config[:knife].has_key?(key)