Skip to content

Commit

Permalink
these values need to be quoted
Browse files Browse the repository at this point in the history
  • Loading branch information
kitchen committed Jan 14, 2015
1 parent ba762bd commit 64c4020
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions spec/defines/collectd_plugin_snmp_data_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
:values => %w{ foo bar baz }
})
}
it { should contain_file('snmp-data-foo.conf').with_content(/Values foo bar baz/) }
it { should contain_file('snmp-data-foo.conf').with_content(/Values "foo" "bar" "baz"/) }
end

context 'values is just a string' do
Expand All @@ -44,7 +44,7 @@
:values => 'bat'
})
}
it { should contain_file('snmp-data-foo.conf').with_content(/Values bat/) }
it { should contain_file('snmp-data-foo.conf').with_content(/Values "bat"/) }
end

context 'table is true' do
Expand Down
4 changes: 2 additions & 2 deletions spec/defines/collectd_plugin_snmp_host_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@
let (:params) {{
:collect => %w{ foo bar baz }
}}
it { should contain_file(filename).with_content(/Collect foo bar baz/) }
it { should contain_file(filename).with_content(/Collect "foo" "bar" "baz"/) }
end

context 'collect is just a string' do
let (:params) {{
:collect => 'bat'
}}
it { should contain_file(filename).with_content(/Collect bat/) }
it { should contain_file(filename).with_content(/Collect "bat"/) }
end
end
2 changes: 1 addition & 1 deletion templates/plugin/snmp/data.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
Type "<%= @type %>"
Table <%= @table_bool ? 'true' : 'false' %>
Instance "<%= @instance %>"
Values <%= Array(@values).join(' ') %>
Values <%= Array(@values).map { |x| %Q{"#{x}"} }.join(' ') %>
</Data>
</Plugin>
2 changes: 1 addition & 1 deletion templates/plugin/snmp/host.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Address "<%= @address %>"
Version <%= @version %>
Community "<%= @community %>"
Collect <%= Array(@collect).join(" ") %>
Collect <%= Array(@collect).map { |x| %Q{"#{x}"} }.join(' ') %>
<%- if !@interval.nil? -%>
Interval <%= @interval %>
<%- end -%>
Expand Down

0 comments on commit 64c4020

Please sign in to comment.