summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@chef.io>2019-11-04 17:57:09 -0800
committerGitHub <noreply@github.com>2019-11-04 17:57:09 -0800
commit80c01598229220a2f90432287f688ec55a615cc3 (patch)
tree610f803d719455fa33887bcbf29e196f97c69084
parentae131f6beb69b7e4f73784f7bef3f91de6ab7b4f (diff)
parent030485f316ad404899fa2fda744b4e0cfbc0908a (diff)
downloadchef-80c01598229220a2f90432287f688ec55a615cc3.tar.gz
[chef-14] backport #9049 (#9051)
[chef-14] backport #9049
-rw-r--r--lib/chef/knife/config_get.rb3
-rw-r--r--spec/integration/knife/config_get_spec.rb7
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/chef/knife/config_get.rb b/lib/chef/knife/config_get.rb
index c687e39a29..db9a2b2b50 100644
--- a/lib/chef/knife/config_get.rb
+++ b/lib/chef/knife/config_get.rb
@@ -47,9 +47,10 @@ class Chef
if wcl.config_location
loading_from("configuration", wcl.config_location)
end
+
if Chef::Config[:config_d_dir]
wcl.find_dot_d(Chef::Config[:config_d_dir]).each do |path|
- loading_from(".d/ configuration", wcl.config_location)
+ loading_from(".d/ configuration", path)
end
end
end
diff --git a/spec/integration/knife/config_get_spec.rb b/spec/integration/knife/config_get_spec.rb
index f34d096051..bdeabf96af 100644
--- a/spec/integration/knife/config_get_spec.rb
+++ b/spec/integration/knife/config_get_spec.rb
@@ -110,6 +110,13 @@ describe "knife config get", :workstation do
it { is_expected.to match(/^node_name:\s+one$/) }
end
+ context "with a config dot d files" do
+ before { file(".chef/config.d/abc.rb", "node_name 'one'\n") }
+
+ it { is_expected.to match(%r{^Loading from .d/ configuration file .*/#{File.basename(path_to("."))}/.chef/config.d/abc.rb$}) }
+ it { is_expected.to match(/^node_name:\s+one$/) }
+ end
+
context "with a credentials file and CHEF_HOME" do
before do
file(".chef/credentials", "[default]\nclient_name = \"three\"\n")