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

Add args parameter to consul::check #400

Merged
merged 1 commit into from Jan 12, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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