summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authordheerajd-msys <dheeraj.dubey@msystechnologies.com>2016-11-18 16:00:53 +0530
committerdheerajd-msys <dheeraj.dubey@msystechnologies.com>2016-11-18 16:00:53 +0530
commit0c0ccba6a97b1a5147e1f3c9891bcf9d15ef7d4b (patch)
tree6f136983fb24b63431e464902f0218248a7920f0 /lib/chef
parent6949868d2722d1528eb780ecdf826ba0150bc02d (diff)
downloadchef-0c0ccba6a97b1a5147e1f3c9891bcf9d15ef7d4b.tar.gz
Handling remaining values of config_log_location
Signed-off-by: dheerajd-msys <dheeraj.dubey@msystechnologies.com>
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/knife/core/bootstrap_context.rb29
1 files changed, 27 insertions, 2 deletions
diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb
index c78327d61f..cc9c6c4903 100644
--- a/lib/chef/knife/core/bootstrap_context.rb
+++ b/lib/chef/knife/core/bootstrap_context.rb
@@ -67,13 +67,38 @@ class Chef
@trusted_certs ||= trusted_certs_content
end
+ def get_log_location
+ if (@chef_config[:config_log_location].nil? || @chef_config[:config_log_location].empty?)
+ "STDOUT"
+ elsif @chef_config[:config_log_location].equal?(:win_evt)
+ raise "The value \:win_evt is not supported for config_log_location on Linux Platforms \n"
+ elsif @chef_config[:config_log_location].equal?(:syslog)
+ ":syslog"
+ elsif (@chef_config[:config_log_location].equal?(STDOUT))
+ "STDOUT"
+ elsif (@chef_config[:config_log_location].equal?(STDERR))
+ "STDERR"
+ elsif @chef_config[:config_log_location]
+ %Q{"#{@chef_config[:config_log_location]}"}
+ else
+ "STDOUT"
+ end
+ end
+
+
+
def config_content
client_rb = <<-CONFIG
-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
+
+ if !(@chef_config[:config_log_level].nil? || @chef_config[:config_log_level].empty?)
+ client_rb << %Q{log_level :#{@chef_config[:config_log_level]}\n}
+ end
+
+ client_rb << "log_location #{get_log_location}\n"
+
if @config[:chef_node_name]
client_rb << %Q{node_name "#{@config[:chef_node_name]}"\n}
else