From f93ba72fbbddaf8ff8c9c2b2aa7a14e2b0c29a8b Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 14 Mar 2012 05:41:41 +0000 Subject: [PATCH] Munge weights to be in the format %.2f The swift ring db converts integers into floats with 2 decimal points percisions. This was causing the ring resources to constantly resync. This commit munges weight in the type to the proper format. --- lib/puppet/type/ring_account_device.rb | 6 +++++- lib/puppet/type/ring_container_device.rb | 6 +++++- lib/puppet/type/ring_object_device.rb | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/puppet/type/ring_account_device.rb b/lib/puppet/type/ring_account_device.rb index 8ea38c88..6e3ea375 100644 --- a/lib/puppet/type/ring_account_device.rb +++ b/lib/puppet/type/ring_account_device.rb @@ -15,7 +15,11 @@ Puppet::Type.newtype(:ring_account_device) do newproperty(:device_name) - newproperty(:weight) + newproperty(:weight) do + munge do |value| + "%.2f" % value + end + end newproperty(:meta) diff --git a/lib/puppet/type/ring_container_device.rb b/lib/puppet/type/ring_container_device.rb index dfad5d9f..e84b31e4 100644 --- a/lib/puppet/type/ring_container_device.rb +++ b/lib/puppet/type/ring_container_device.rb @@ -15,7 +15,11 @@ Puppet::Type.newtype(:ring_container_device) do newproperty(:device_name) - newproperty(:weight) + newproperty(:weight) do + munge do |value| + "%.2f" % value + end + end newproperty(:meta) diff --git a/lib/puppet/type/ring_object_device.rb b/lib/puppet/type/ring_object_device.rb index c9da89aa..afcd6d66 100644 --- a/lib/puppet/type/ring_object_device.rb +++ b/lib/puppet/type/ring_object_device.rb @@ -15,7 +15,11 @@ Puppet::Type.newtype(:ring_object_device) do newproperty(:device_name) - newproperty(:weight) + newproperty(:weight) do + munge do |value| + "%.2f" % value + end + end newproperty(:meta)