Skip to content

Commit

Permalink
Merge pull request #400 from joshuaspence/args
Browse files Browse the repository at this point in the history
Add `args` parameter to `consul::check`
  • Loading branch information
solarkennedy committed Jan 12, 2018
2 parents a8ecd96 + ad58b26 commit 48072cb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
10 changes: 8 additions & 2 deletions manifests/check.pp
Expand Up @@ -23,7 +23,11 @@
#
# [*script*]
# Full path to the location of the healthcheck script. Must be nagios
# compliant with regards to the return codes.
# compliant with regards to the return codes. This parameter is deprecated
# in Consul 1.0.0, see https://github.com/hashicorp/consul/issues/3509.
#
# [*args*]
# Arguments to be `exec`ed for the healthcheck script.
#
# [*service_id*]
# An optional service_id to match this check against
Expand Down Expand Up @@ -53,6 +57,7 @@
$interval = undef,
$notes = undef,
$script = undef,
$args = undef,
$service_id = undef,
$status = undef,
$tcp = undef,
Expand All @@ -68,9 +73,10 @@
'ttl' => $ttl,
'http' => $http,
'script' => $script,
'args' => $args,
'tcp' => $tcp,
'interval' => $interval,
'timeout' => $timeout,
'timeout' => $timeout,
'service_id' => $service_id,
'notes' => $notes,
'token' => $token,
Expand Down
14 changes: 14 additions & 0 deletions spec/defines/consul_check_spec.rb
Expand Up @@ -27,6 +27,20 @@
.with_content(/"script" *: *"true"/)
}
end
describe 'with args' do
let(:params) {{
'interval' => '30s',
'args' => ['sh', '-c', 'true'],
}}
it {
should contain_file("/etc/consul/check_my_check.json") \
.with_content(/"id" *: *"my_check"/) \
.with_content(/"name" *: *"my_check"/) \
.with_content(/"check" *: *\{/) \
.with_content(/"interval" *: *"30s"/) \
.with_content(/"args" *: *\[ *"sh", *"-c", *"true" *\]/)
}
end
describe 'with script and service_id' do
let(:params) {{
'interval' => '30s',
Expand Down

0 comments on commit 48072cb

Please sign in to comment.