From f126d462abe771b873165f2c9566531e44c1aa90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Gagne=CC=81?= Date: Tue, 21 May 2013 19:30:22 -0400 Subject: [PATCH] Capitalize boolean values in config files This patch allows the usage of Puppet boolean values and still configure values with OpenStack boolean style: True/False. Change-Id: I1f96bf979e67fd7fb8fd1d984809fd072783224c --- lib/puppet/type/glance_api_config.rb | 7 ++++--- lib/puppet/type/glance_api_paste_ini.rb | 7 ++++--- lib/puppet/type/glance_cache_config.rb | 7 ++++--- lib/puppet/type/glance_registry_config.rb | 7 ++++--- lib/puppet/type/glance_registry_paste_ini.rb | 7 ++++--- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/lib/puppet/type/glance_api_config.rb b/lib/puppet/type/glance_api_config.rb index 97e171cf..d7bd10f9 100644 --- a/lib/puppet/type/glance_api_config.rb +++ b/lib/puppet/type/glance_api_config.rb @@ -9,10 +9,11 @@ Puppet::Type.newtype(:glance_api_config) do newproperty(:value) do desc 'The value of the setting to be defined.' - munge do |v| - v.to_s.strip + munge do |value| + value = value.to_s.strip + value.capitalize! if value =~ /^(true|false)$/i + value end end - end diff --git a/lib/puppet/type/glance_api_paste_ini.rb b/lib/puppet/type/glance_api_paste_ini.rb index 8e3eb4e0..740f2bbc 100644 --- a/lib/puppet/type/glance_api_paste_ini.rb +++ b/lib/puppet/type/glance_api_paste_ini.rb @@ -9,10 +9,11 @@ Puppet::Type.newtype(:glance_api_paste_ini) do newproperty(:value) do desc 'The value of the setting to be defined.' - munge do |v| - v.to_s.strip + munge do |value| + value = value.to_s.strip + value.capitalize! if value =~ /^(true|false)$/i + value end end - end diff --git a/lib/puppet/type/glance_cache_config.rb b/lib/puppet/type/glance_cache_config.rb index d35d68d7..ae0254e1 100644 --- a/lib/puppet/type/glance_cache_config.rb +++ b/lib/puppet/type/glance_cache_config.rb @@ -9,10 +9,11 @@ Puppet::Type.newtype(:glance_cache_config) do newproperty(:value) do desc 'The value of the setting to be defined.' - munge do |v| - v.to_s.strip + munge do |value| + value = value.to_s.strip + value.capitalize! if value =~ /^(true|false)$/i + value end end - end diff --git a/lib/puppet/type/glance_registry_config.rb b/lib/puppet/type/glance_registry_config.rb index f51213b8..3b08e6a6 100644 --- a/lib/puppet/type/glance_registry_config.rb +++ b/lib/puppet/type/glance_registry_config.rb @@ -9,10 +9,11 @@ Puppet::Type.newtype(:glance_registry_config) do newproperty(:value) do desc 'The value of the setting to be defined.' - munge do |v| - v.to_s.strip + munge do |value| + value = value.to_s.strip + value.capitalize! if value =~ /^(true|false)$/i + value end end - end diff --git a/lib/puppet/type/glance_registry_paste_ini.rb b/lib/puppet/type/glance_registry_paste_ini.rb index 8b96a655..8c9b956b 100644 --- a/lib/puppet/type/glance_registry_paste_ini.rb +++ b/lib/puppet/type/glance_registry_paste_ini.rb @@ -9,10 +9,11 @@ Puppet::Type.newtype(:glance_registry_paste_ini) do newproperty(:value) do desc 'The value of the setting to be defined.' - munge do |v| - v.to_s.strip + munge do |value| + value = value.to_s.strip + value.capitalize! if value =~ /^(true|false)$/i + value end end - end