Skip to content

Commit

Permalink
Merge pull request #424 from vsudilov/issue#423-default-client-mode
Browse files Browse the repository at this point in the history
attributes: explicit node.default server->false
  • Loading branch information
legal90 authored Apr 23, 2017
2 parents d1a4af3 + 788641a commit da7f406
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
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 @@ -90,7 +90,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 @@ -192,8 +192,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

0 comments on commit da7f406

Please sign in to comment.