Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template supermarket json #6

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 9 additions & 18 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,6 @@
action :create
end

# Sanity check the oc-id attributes
%w(chef_server_url chef_oauth2_app_id chef_oauth2_secret).each do |attr|
unless node['supermarket_omnibus'][attr].is_a?(String)
Chef::Log.fatal("You did not set the node['supermarket_omnibus']['#{attr}'] value!")
Chef::Log.fatal('Please set this attribute before continuing')
raise
end
end

file '/etc/supermarket/supermarket.json' do
action :create
owner "root"
group "root"
mode "0644"
content JSON.pretty_generate(node['supermarket_omnibus'])
notifies :reconfigure, 'chef_server_ingredient[supermarket]'
end

chef_server_ingredient 'supermarket' do
ctl_command '/opt/supermarket/bin/supermarket-ctl'

Expand All @@ -49,3 +31,12 @@

notifies :reconfigure, 'chef_server_ingredient[supermarket]'
end

template '/etc/supermarket/supermarket.json' do
source 'supermarket.json.erb'
owner 'root'
group 'root'
mode "0644"
action :create
notifies :reconfigure, 'chef_server_ingredient[supermarket]'
end
6 changes: 6 additions & 0 deletions templates/default/supermarket.json.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"chef_server_url": "<%= node['supermarket_omnibus']['chef_server_url'] %>",
"chef_oauth2_app_id": "<%= node['supermarket_omnibus']['chef_oauth2_app_id'] %>",
"chef_oauth2_secret": "<%= node['supermarket_omnibus']['chef_oauth2_secret'] %>",
"chef_oauth2_verify_ssl": <%= node['supermarket_omnibus']['chef_oauth2_verify_ssl'] %>
}