diff --git a/lib/puppet/type/rabbitmq_parameter.rb b/lib/puppet/type/rabbitmq_parameter.rb index 30ac90c9c..b3121e670 100644 --- a/lib/puppet/type/rabbitmq_parameter.rb +++ b/lib/puppet/type/rabbitmq_parameter.rb @@ -106,9 +106,12 @@ def validate_value(value) def munge_value(value) return value if value(:autoconvert) == :false - value.each do |k, v| - value[k] = v.to_i if v =~ %r{\A[-+]?[0-9]+\z} + value.transform_values do |v| + if v.is_a?(String) && v.match?(%r{\A[-+]?[0-9]+\z}) + v.to_i + else + v + end end - value end end diff --git a/spec/unit/puppet/type/rabbitmq_parameter_spec.rb b/spec/unit/puppet/type/rabbitmq_parameter_spec.rb index f03b2c42e..8fc81c226 100644 --- a/spec/unit/puppet/type/rabbitmq_parameter_spec.rb +++ b/spec/unit/puppet/type/rabbitmq_parameter_spec.rb @@ -44,9 +44,8 @@ end it 'accepts a valid hash for value' do - value = { 'message-ttl' => '1800000' } - parameter[:value] = value - expect(parameter[:value]).to eq(value) + parameter[:value] = { 'message-ttl' => '1800000' } + expect(parameter[:value]).to eq({ 'message-ttl' => 1_800_000 }) end it 'does not accept an empty string for definition' do