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

implemented service meta parameters #436

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
# [*token*]
# ACL token for interacting with the catalog (must be 'management' type)
#
# [*meta*]
# Service meta tags
#
define consul::service(
$address = undef,
$checks = [],
Expand All @@ -43,6 +46,7 @@
$service_name = $title,
$tags = [],
$token = undef,
$meta = {},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a datatype to the new parameter? We would like to have them for all new parameters.

) {
include consul

Expand All @@ -62,6 +66,7 @@
'tags' => $tags,
'checks' => $checks,
'token' => $token,
'meta' => $meta,
$override_key => $enable_tag_override,
}

Expand Down
15 changes: 15 additions & 0 deletions spec/defines/consul_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
it {
should contain_file("/etc/consul/service_my_service.json") \
.with_content(/"service" *: *\{/) \
.with_content(/"meta" *: *\{\}/) \
.with_content(/"id" *: *"my_service"/) \
.with_content(/"name" *: *"my_service"/) \
.with_content(/"enableTagOverride" *: *false/)
Expand All @@ -22,6 +23,7 @@
it {
should contain_file("/etc/consul/service_my_service.json") \
.with_content(/"service" *: *\{/) \
.with_content(/"meta" *: *\{\}/) \
.with_content(/"id" *: *"my_service"/) \
.with_content(/"name" *: *"my_service"/) \
.with_content(/"enable_tag_override" *: *false/)
Expand Down Expand Up @@ -256,4 +258,17 @@
.with_content(/"token" *: *"too-cool-for-this-service"/)
}
end
describe 'with meta' do
let(:params) {{
'meta' => {
'foo' => 'bar',
},
}}

it {
should contain_file("/etc/consul/service_my_service.json") \
.with_content(/"meta" *: *\{/) \
.with_content(/"foo" *: *"bar"/)
}
end
end