From 77edbcefbe077e802bbfbd44810856519c1824df Mon Sep 17 00:00:00 2001 From: Riley Shott Date: Fri, 5 Feb 2016 15:46:04 -0800 Subject: [PATCH 1/3] Changed data_dir attribute value to be dependent on OS In order to preserve backwards compatibility, data_dir on Linux should just be '/var/lib/consul'. For cleanliness on Windows, it should be all be contained underneath a 'data' folder. --- attributes/default.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index 59d0b6bd..c48c8457 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'] = data_prefix_path +default['consul']['config']['data_dir'] = windows? ? join_path(data_prefix_path, 'data') : 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' From 5e6c191f7edab210bc926c725a53f076e3690412 Mon Sep 17 00:00:00 2001 From: Riley Shott Date: Fri, 5 Feb 2016 15:55:33 -0800 Subject: [PATCH 2/3] Added chkconfig lines for CentOS 5 Without these two lines chkconfig on CentOS 5 complains when trying to check its status. --- templates/default/sysvinit.service.erb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/default/sysvinit.service.erb b/templates/default/sysvinit.service.erb index 69bca8b6..408b2ed4 100644 --- a/templates/default/sysvinit.service.erb +++ b/templates/default/sysvinit.service.erb @@ -2,6 +2,9 @@ # # <%= @name %> - this script manages the consul agent # +# chkconfig: 345 99 70 +# description: this script manages the consul agent +# ### BEGIN INIT INFO # Provides: <%= @name %> # Required-Start: $local_fs $network From 2709a44c05f520cb2f76bbd8d436ed4dee9946c0 Mon Sep 17 00:00:00 2001 From: Riley Shott Date: Fri, 5 Feb 2016 16:02:55 -0800 Subject: [PATCH 3/3] Fix spec test --- test/spec/libraries/consul_service_windows_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/spec/libraries/consul_service_windows_spec.rb b/test/spec/libraries/consul_service_windows_spec.rb index 7a3f8b80..20cf0e58 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') } + it { is_expected.to create_directory('C:\Program Files\consul\data') } 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"""'