Skip to content

Commit

Permalink
update the init script properly as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Wil committed Oct 29, 2014
1 parent ec28d22 commit b448e1d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
11 changes: 10 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@
default['consul']['service_mode'] = 'bootstrap'
default['consul']['data_dir'] = '/var/lib/consul'
default['consul']['config_dir'] = '/etc/consul.d'
case node['platform_family']
when 'debian'
default['consul']['etc_config_dir'] = '/etc/default/consul'
when 'rhel'
default['consul']['etc_config_dir'] = '/etc/sysconfig/consul'
else
default['consul']['etc_config_dir'] = '/etc/sysconfig/consul'
end

default['consul']['servers'] = []
default['consul']['init_style'] = 'init' # 'init', 'runit'
default['consul']['service_user'] = 'consul'
Expand All @@ -60,4 +69,4 @@
# UI attributes
default['consul']['client_addr'] = '0.0.0.0'
default['consul']['ui_dir'] = '/var/lib/consul/ui'
default['consul']['serve_ui'] = false
default['consul']['serve_ui'] = false
8 changes: 1 addition & 7 deletions recipes/_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,7 @@

case node['consul']['init_style']
when 'init'
if platform_family?('debian')
etc_config_dir = '/etc/default/consul'
else
etc_config_dir = '/etc/sysconfig/consul'
end

template etc_config_dir do
template node['consul']['etc_config_dir'] do
source 'consul-sysconfig.erb'
mode 0755
notifies :create, 'template[/etc/init.d/consul]', :immediately
Expand Down
4 changes: 2 additions & 2 deletions templates/default/consul-init.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
# * Multi Datacenter
### END INIT INFO

if [ -f /etc/sysconfig/consul ]; then
. /etc/sysconfig/consul
if [ -f <%= node['consul']['etc_config_dir'] %> ]; then
. <%= node['consul']['etc_config_dir'] %>
fi

export GOMAXPROCS=${GOMAXPROCS}
Expand Down

0 comments on commit b448e1d

Please sign in to comment.