Skip to content

Commit

Permalink
Merge pull request #92 from ericfode/attribute-fix
Browse files Browse the repository at this point in the history
The service_user and group option were being locally overriden in the service
  • Loading branch information
johnbellone committed Dec 11, 2014
2 parents 71eb1c6 + b310593 commit 7c74f79
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 10 additions & 2 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,16 @@

default['consul']['servers'] = []
default['consul']['init_style'] = 'init' # 'init', 'runit'
default['consul']['service_user'] = 'consul'
default['consul']['service_group'] = 'consul'

case node['consul']['init_style']
when 'runit'
default['consul']['service_user'] = 'consul'
default['consul']['service_group'] = 'consul'
else
default['consul']['service_user'] = 'root'
default['consul']['service_group'] = 'root'
end

default['consul']['ports'] = {
'dns' => 8600,
'http' => 8500,
Expand Down
12 changes: 4 additions & 8 deletions recipes/_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,14 @@
consul_directories << '/var/lib/consul'

# Select service user & group
case node['consul']['init_style']
when 'runit'
if node['consul']['init_style'] == 'runit'
include_recipe 'runit::default'

consul_user = node['consul']['service_user']
consul_group = node['consul']['service_group']
consul_directories << '/var/log/consul'
else
consul_user = 'root'
consul_group = 'root'
end

consul_user = node['consul']['service_user']
consul_group = node['consul']['service_group']

# Create service user
user "consul service user: #{consul_user}" do
not_if { consul_user == 'root' }
Expand Down

0 comments on commit 7c74f79

Please sign in to comment.