blob: 0a0db02249118a9e814fa269b3360321bbdd393e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
<% %w(@node_name
@chef_license
@chef_server_url
@event_loggers
@file_backup_path
@file_cache_path
@file_staging_uses_destdir
@formatters
@http_proxy
@https_proxy
@ftp_proxy
@log_level
@minimal_ohai
@named_run_list
@no_proxy
@ohai_disabled_plugins
@ohai_optional_plugins
@pid_file
@policy_group
@policy_name
@ssl_verify_mode
@policy_persist_run_list).each do |prop| -%>
<% next if instance_variable_get(prop).nil? || instance_variable_get(prop).empty? -%>
<%=prop.delete_prefix("@") %> <%= instance_variable_get(prop).inspect %>
<% end -%>
<%# ohai_disabled_plugins and ohai_optional_plugins properties don't match the config value perfectly-%>
<% %w(@ohai_disabled_plugins
@ohai_optional_plugins).each do |prop| -%>
<% next if instance_variable_get(prop).nil? || instance_variable_get(prop).empty? -%>
<%=prop.gsub("@ohai_", "ohai.") %> <%= instance_variable_get(prop).inspect %>
<% end -%>
<%# log_location is special due to STDOUT/STDERR from String -> IO Object -%>
<% unless @log_location.nil? %>
<% if @log_location.is_a?(String) && %w(STDOUT STDERR).include?(@log_location) -%>
log_location <%= @log_location %>
<% else -%>
log_location <%= @log_location.inspect %>
<% end -%>
<% end -%>
<%# The code below is not DRY on purpose to improve readability -%>
<% unless @start_handlers.empty? -%>
# Do not crash if a start handler is missing / not installed yet
begin
<% @start_handlers.each do |handler| -%>
start_handlers << <%= @handler %>
<% end -%>
rescue NameError => e
Chef::Log.error e
end
<% end -%>
<% unless @report_handlers.empty? -%>
# Do not crash if a report handler is missing / not installed yet
begin
<% @report_handlers.each do |handler| -%>
report_handlers << <%= @handler %>
<% end -%>
rescue NameError => e
Chef::Log.error e
end
<% end -%>
<% unless @exception_handlers.empty? -%>
# Do not crash if an exception handler is missing / not installed yet
begin
<% @exception_handlers.each do |handler| -%>
exception_handlers << <%= @handler %>
<% end -%>
rescue NameError => e
Chef::Log.error e
end
<% end -%>
<%= @additional_config -%>
|