Skip to content

Commit

Permalink
Create default.json config as JSON dump
Browse files Browse the repository at this point in the history
And actually as JSON; previously it was formatted as HCL.
  • Loading branch information
tgwizard committed Feb 2, 2015
1 parent 4e58392 commit c700562
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
6 changes: 4 additions & 2 deletions recipes/service.rb
Expand Up @@ -7,6 +7,8 @@
#
#

require 'json'

# Configure directories
consul_template_directories = []
consul_template_directories << node['consul_template']['config_dir']
Expand Down Expand Up @@ -50,12 +52,12 @@

# Define global options here. use consul_template lwrp to register new
# templates
template File.join(node['consul_template']['config_dir'], 'default.json') do
source 'config.json.erb'
file File.join(node['consul_template']['config_dir'], 'default.json') do
user consul_template_user
group consul_template_group
mode node['consul_template']['template_mode']
action :create
content JSON.pretty_generate(node['consul_template']['config'], quirks_mode: true)
notifies :restart, 'service[consul-template]', :delayed
end

Expand Down
2 changes: 1 addition & 1 deletion spec/recipes/service_spec.rb
Expand Up @@ -8,7 +8,7 @@
end

it 'should create the consul-template default config' do
expect(chef_run).to create_template('/etc/consul-template.d/default.json')
expect(chef_run).to create_file('/etc/consul-template.d/default.json')
end

it 'should enable the consul-template service' do
Expand Down
5 changes: 0 additions & 5 deletions templates/default/config.json.erb

This file was deleted.

0 comments on commit c700562

Please sign in to comment.