diff --git a/libraries/consul_watch.rb b/libraries/consul_watch.rb index 6886742c..d6dde431 100644 --- a/libraries/consul_watch.rb +++ b/libraries/consul_watch.rb @@ -21,11 +21,11 @@ class ConsulWatch < Chef::Resource # @!attribute user # @return [String] - attribute(:user, kind_of: String, default: 'consul') + attribute(:user, kind_of: String, default: lazy { node['consul']['service_user'] }) # @!attribute group # @return [String] - attribute(:group, kind_of: String, default: 'consul') + attribute(:group, kind_of: String, default: lazy { node['consul']['service_group'] }) # @!attribute type # @return [String] diff --git a/test/spec/libraries/consul_watch_spec.rb b/test/spec/libraries/consul_watch_spec.rb index 4a417178..9fd4cdb0 100644 --- a/test/spec/libraries/consul_watch_spec.rb +++ b/test/spec/libraries/consul_watch_spec.rb @@ -6,6 +6,8 @@ let(:chefspec_options) { { platform: 'ubuntu', version: '14.04' } } before do default_attributes['consul'] = { + 'service_user' => 'consul', + 'service_group' => 'consul', 'service' => { 'config_dir' => '/etc/consul/conf.d', },