File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919#
2020# class { 'datadog_agent::integrations::cassandra' :
2121# host => 'localhost',
22+ # tags => {
23+ # environment => "production",
24+ # },
2225# }
2326#
2427#
2730 $port = 7199,
2831 $user = undef ,
2932 $password = undef ,
30- $tags = [] ,
33+ $tags = {} ,
3134) inherits datadog_agent::params {
3235 require ::datadog_agent
33- validate_array ($tags )
36+ validate_hash ($tags )
3437
3538 file { "${datadog_agent::params::conf_dir}/cassandra.yaml" :
3639 ensure => file ,
Original file line number Diff line number Diff line change 4646 it { should contain_file ( conf_file ) . with_content ( %r{user: baz} ) }
4747 end
4848
49- context 'with tags parameter array ' do
49+ context 'with tags parameter hash ' do
5050 let ( :params ) { {
5151 password : 'foobar' ,
52- tags : %w{ foo bar baz } ,
52+ tags : {
53+ 'foo' => 'bar' ,
54+ 'baz' => 'ama' ,
55+ }
5356 } }
54- it { should contain_file ( conf_file ) . with_content ( /tags:[^-]+- foo \s +- bar\s +- baz\s *?[^-]/m ) }
57+ it { should contain_file ( conf_file ) . with_content ( /tags:\s +foo: bar\s +baz: ama \s *?[^-]/m ) }
5558 end
5659
57- context 'tags not array ' do
60+ context 'tags not hash ' do
5861 let ( :params ) { {
5962 password : 'foobar' ,
6063 tags : 'aoeu' ,
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ instances:
1212<% end -%>
1313<% if @tags.length > 0 -%>
1414 tags:
15- <% @tags.each do |tag | -%>
16- - <%= tag %>
15+ <%- @tags.each do |tag_name, tag_value | -%>
16+ <%= tag_name %> : <%= tag_value %>
1717<% end -%>
1818<% end -%>
1919
You can’t perform that action at this time.
0 commit comments