From 64c4020e5aaf56e0da6cf1e20601117f10fb9a7e Mon Sep 17 00:00:00 2001 From: Jeremy Kitchen Date: Wed, 14 Jan 2015 04:51:24 +0000 Subject: [PATCH] these values need to be quoted --- spec/defines/collectd_plugin_snmp_data_spec.rb | 4 ++-- spec/defines/collectd_plugin_snmp_host_spec.rb | 4 ++-- templates/plugin/snmp/data.conf.erb | 2 +- templates/plugin/snmp/host.conf.erb | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/defines/collectd_plugin_snmp_data_spec.rb b/spec/defines/collectd_plugin_snmp_data_spec.rb index 91f1c255a..bde036537 100644 --- a/spec/defines/collectd_plugin_snmp_data_spec.rb +++ b/spec/defines/collectd_plugin_snmp_data_spec.rb @@ -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 @@ -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 diff --git a/spec/defines/collectd_plugin_snmp_host_spec.rb b/spec/defines/collectd_plugin_snmp_host_spec.rb index 210226dda..30ed82687 100644 --- a/spec/defines/collectd_plugin_snmp_host_spec.rb +++ b/spec/defines/collectd_plugin_snmp_host_spec.rb @@ -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 diff --git a/templates/plugin/snmp/data.conf.erb b/templates/plugin/snmp/data.conf.erb index 79852b064..abea2f9de 100644 --- a/templates/plugin/snmp/data.conf.erb +++ b/templates/plugin/snmp/data.conf.erb @@ -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(' ') %> diff --git a/templates/plugin/snmp/host.conf.erb b/templates/plugin/snmp/host.conf.erb index 2a8c8a2d4..fc91cd02c 100644 --- a/templates/plugin/snmp/host.conf.erb +++ b/templates/plugin/snmp/host.conf.erb @@ -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 -%>