summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordheerajd-msys <dheeraj.dubey@msystechnologies.com>2016-11-01 17:12:20 +0530
committerdheerajd-msys <dheeraj.dubey@msystechnologies.com>2016-11-09 13:00:47 +0530
commit6949868d2722d1528eb780ecdf826ba0150bc02d (patch)
treea3f69c1f5f2e0107bd1c1b621aa9abe8c988b928
parenta155e20e796e16902498634efe9798b135395d9a (diff)
downloadchef-6949868d2722d1528eb780ecdf826ba0150bc02d.tar.gz
Passing config_log_level and config_log_location in client.rb and fixed specs failure
Signed-off-by: dheerajd-msys <dheeraj.dubey@msystechnologies.com>
-rw-r--r--lib/chef/knife/core/bootstrap_context.rb3
-rw-r--r--spec/unit/knife/core/bootstrap_context_spec.rb9
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb
index b2670f196b..c78327d61f 100644
--- a/lib/chef/knife/core/bootstrap_context.rb
+++ b/lib/chef/knife/core/bootstrap_context.rb
@@ -69,7 +69,8 @@ class Chef
def config_content
client_rb = <<-CONFIG
-log_location STDOUT
+log_level :#{@chef_config[:config_log_level]}
+log_location "#{@chef_config[:config_log_location]}"
chef_server_url "#{@chef_config[:chef_server_url]}"
validation_client_name "#{@chef_config[:validation_client_name]}"
CONFIG
diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb
index 6465e18ac9..dc3a33a9ca 100644
--- a/spec/unit/knife/core/bootstrap_context_spec.rb
+++ b/spec/unit/knife/core/bootstrap_context_spec.rb
@@ -30,6 +30,8 @@ describe Chef::Knife::Core::BootstrapContext do
let(:run_list) { Chef::RunList.new("recipe[tmux]", "role[base]") }
let(:chef_config) do
{
+ :config_log_level => "info",
+ :config_log_location => "/tmp/log",
:validation_key => File.join(CHEF_SPEC_DATA, "ssl", "private_key.pem"),
:chef_server_url => "http://chef.example.com:4444",
:validation_client_name => "chef-validator-testing",
@@ -68,7 +70,8 @@ describe Chef::Knife::Core::BootstrapContext do
it "generates the config file data" do
expected = <<-EXPECTED
-log_location STDOUT
+log_level :info
+log_location "/tmp/log"
chef_server_url "http://chef.example.com:4444"
validation_client_name "chef-validator-testing"
# Using default node name (fqdn)
@@ -76,10 +79,6 @@ EXPECTED
expect(bootstrap_context.config_content).to eq expected
end
- it "does not set a default log_level" do
- expect(bootstrap_context.config_content).not_to match(/log_level/)
- end
-
describe "alternate chef-client path" do
let(:chef_config) { { :chef_client_path => "/usr/local/bin/chef-client" } }
it "runs chef-client from another path when specified" do