Skip to content

Commit

Permalink
Merge pull request #1247 from chef/mp/do-not-write-ldap-block-when-di…
Browse files Browse the repository at this point in the history
…sabled

Exclude ldap in -running.json if disabled.
  • Loading branch information
marcparadise authored May 2, 2017
2 parents eedc17f + 6981969 commit f8fe06d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,29 @@ def remote_install_addons?
# chef-solo and chef-client -z return different things :(
(node['private_chef']['addons']['path'] == nil) || (node['private_chef']['addons']['path'] == {})
end

def self.chef_server_running_content(node)
attrs = node['private_chef'].to_hash
# To preserve compatibility with other add-ons and tools
# which use the presence of an `ldap` key as an indicator that
# ldap is enabled on Chef Server, removed the ldap section
# if it's disabled.
unless attrs['ldap'] && attrs['ldap']['enabled']
attrs.delete('ldap')
end

# back-compat fixes for opscode-reporting
# reporting uses the opscode-solr key for determining the location of the
# solr host, so we'll copy the contents over from opscode-solr4
attrs['opscode-solr'] ||= {}
attrs['opscode-solr']['vip'] = attrs['opscode-solr4']['vip']
attrs['opscode-solr']['port'] = attrs['opscode-solr4']['port']

content = {
"private_chef" => attrs,
"run_list" => node.run_list,
"runit" => node['runit'].to_hash
}
Chef::JSONCompat.to_json_pretty(content)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -175,21 +175,7 @@
owner OmnibusHelper.new(node).ownership['owner']
group "root"
mode "0600"

file_content = {
"private_chef" => node['private_chef'].to_hash,
"run_list" => node.run_list,
"runit" => node['runit'].to_hash
}
# back-compat fixes for opscode-reporting
# reporting uses the opscode-solr key for determining the location of the solr host,
# so we'll copy the contents over from opscode-solr4
file_content['private_chef']['opscode-solr'] ||= {}
%w{vip port}.each do |key|
file_content['private_chef']['opscode-solr'][key] = file_content['private_chef']['opscode-solr4'][key]
end

content Chef::JSONCompat.to_json_pretty(file_content)
content lazy { OmnibusHelper.chef_server_running_content(node) }
end

ruby_block "print reconfigure warnings" do
Expand Down

0 comments on commit f8fe06d

Please sign in to comment.