diff options
-rw-r--r-- | lib/chef/knife/config_get.rb | 3 | ||||
-rw-r--r-- | spec/integration/knife/config_get_spec.rb | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/chef/knife/config_get.rb b/lib/chef/knife/config_get.rb index b07bef9a36..c194188d2a 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 98fefd729f..83150a39b8 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") |