From aac210a1fad6020705283183b8f6e9c0d42a1747 Mon Sep 17 00:00:00 2001 From: Riley Shott Date: Fri, 29 Jan 2016 06:47:47 -0800 Subject: [PATCH] Fixed data_dir path for both config/service @legal90 kindly pointed out that the default value for ['consul']['config']['data_dir'] & ['consul']['service']['data_dir'] was changed to append 'data' as the last folder. Consul actually creates this directory for you when you start the service. And if you didn't change both, it could cause the Consul agent to fail. --- attributes/default.rb | 2 +- test/spec/libraries/consul_service_linux_spec.rb | 2 +- test/spec/libraries/consul_service_windows_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index b7dd0dee..59d0b6bd 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -15,7 +15,7 @@ default['consul']['config']['bag_item'] = 'consul' default['consul']['config']['path'] = join_path config_prefix_path, 'consul.json' -default['consul']['config']['data_dir'] = join_path data_prefix_path, 'data' +default['consul']['config']['data_dir'] = data_prefix_path default['consul']['config']['ca_file'] = join_path config_prefix_path, 'ssl', 'CA', 'ca.crt' default['consul']['config']['cert_file'] = join_path config_prefix_path, 'ssl', 'certs', 'consul.crt' default['consul']['config']['key_file'] = join_path config_prefix_path, 'ssl', 'private', 'consul.key' diff --git a/test/spec/libraries/consul_service_linux_spec.rb b/test/spec/libraries/consul_service_linux_spec.rb index 460039ea..c40426e3 100644 --- a/test/spec/libraries/consul_service_linux_spec.rb +++ b/test/spec/libraries/consul_service_linux_spec.rb @@ -9,6 +9,6 @@ recipe 'consul::default' it { expect(chef_run).to create_directory('/etc/consul/conf.d') } - it { is_expected.to create_directory('/var/lib/consul/data') } + it { is_expected.to create_directory('/var/lib/consul') } end end diff --git a/test/spec/libraries/consul_service_windows_spec.rb b/test/spec/libraries/consul_service_windows_spec.rb index 20cf0e58..7a3f8b80 100644 --- a/test/spec/libraries/consul_service_windows_spec.rb +++ b/test/spec/libraries/consul_service_windows_spec.rb @@ -21,7 +21,7 @@ recipe 'consul::default' it { expect(chef_run).to create_directory('C:\Program Files\consul\conf.d') } - it { is_expected.to create_directory('C:\Program Files\consul\data') } + it { is_expected.to create_directory('C:\Program Files\consul') } it { expect(chef_run).to install_nssm('consul').with( program: 'C:\Program Files\consul\consul.exe', args: 'agent -config-file="""C:\Program Files\consul\consul.json""" -config-dir="""C:\Program Files\consul\conf.d"""'