Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "service_user" and "service_group" attributes as defaults for resource params #445

Merged
merged 2 commits into from
Jun 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libraries/consul_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ class ConsulService < Chef::Resource
# @!attribute user
# The service user the Consul process runs as.
# @return [String]
attribute(:user, kind_of: String, default: 'consul')
attribute(:user, kind_of: String, default: lazy { node['consul']['service_user'] })
# @!attribute group
# The service group the Consul process runs as.
# @return [String]
attribute(:group, kind_of: String, default: 'consul')
attribute(:group, kind_of: String, default: lazy { node['consul']['service_group'] })
# @!attribute environment
# The environment that the Consul process starts with.
# @return [String]
Expand Down
4 changes: 2 additions & 2 deletions libraries/consul_watch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 2 additions & 0 deletions test/spec/libraries/consul_watch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
Expand Down