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

consul_config: Remove the default value of "server" param #424

Merged
merged 5 commits into from
Apr 23, 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
7 changes: 2 additions & 5 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,10 @@ suites:
acl_default_policy: deny
excludes:
- windows-2012r2

- name: client
named_run_list: client
attributes:
consul:
config:
server: false
bootstrap_expect: 1

- name: git
attributes:
go:
Expand Down
7 changes: 4 additions & 3 deletions libraries/consul_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class ConsulConfig < Chef::Resource
attribute(:rejoin_after_leave, equal_to: [true, false], default: true)
attribute(:serf_lan_bind, kind_of: String)
attribute(:serf_wan_bind, kind_of: String)
attribute(:server, equal_to: [true, false], default: true)
attribute(:server, equal_to: [true, false])
attribute(:server_name, kind_of: String)
attribute(:session_ttl_min, kind_of: String)
attribute(:skip_leave_on_interrupt, equal_to: [true, false], default: false)
Expand Down Expand Up @@ -190,8 +190,9 @@ def to_json
for_keeps << %i(ca_file cert_file key_file) if tls?
for_keeps = for_keeps.flatten

config = to_hash.keep_if do |k, _|
for_keeps.include?(k.to_sym)
# Filter out undefined attributes and keep only those listed above
config = to_hash.keep_if do |k, v|
!v.nil? && for_keeps.include?(k.to_sym)
end.merge(options)
JSON.pretty_generate(Hash[config.sort_by { |k, _| k.to_s }], quirks_mode: true)
end
Expand Down
1 change: 0 additions & 1 deletion test/spec/libraries/consul_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
.with(content: <<-EOH.chomp.gsub(/^ /, ''))
{
"recursor": "foo",
"server": true,
"translate_wan_addrs": true,
"verify_incoming": false,
"verify_outgoing": false
Expand Down