Skip to content

Commit

Permalink
Merge pull request #222 from wk8/wk8/fix_watch_syntax
Browse files Browse the repository at this point in the history
Fixing the syntax for Consul watches
  • Loading branch information
johnbellone committed Sep 25, 2015
2 parents bedf13e + 3670858 commit 169703e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libraries/consul_watch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ConsulWatch < Chef::Resource
attribute(:parameters, option_collector: true, default: {})

def to_json
JSON.pretty_generate({ type: type }.merge(parameters))
JSON.pretty_generate(watches: [{ type: type }.merge(parameters)])
end

action(:create) do
Expand Down
10 changes: 7 additions & 3 deletions test/spec/libraries/consul_watch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@
.with(user: 'consul', group: 'consul', mode: '0640')
.with(content: JSON.pretty_generate(
{
type: 'key',
key: 'foo/bar/baz',
handler: '/bin/false'
watches: [
{
type: 'key',
key: 'foo/bar/baz',
handler: '/bin/false'
}
]
}
))
end
Expand Down

0 comments on commit 169703e

Please sign in to comment.