diff --git a/lib/puppet/provider/glance.rb b/lib/puppet/provider/glance.rb index a47e7109..4e66429f 100644 --- a/lib/puppet/provider/glance.rb +++ b/lib/puppet/provider/glance.rb @@ -8,8 +8,4 @@ class Puppet::Provider::Glance < Puppet::Provider::Openstack extend Puppet::Provider::Openstack::Auth - def bool_to_sym(bool) - bool == true ? :true : :false - end - end diff --git a/lib/puppet/provider/glance_image/openstack.rb b/lib/puppet/provider/glance_image/openstack.rb index cb4114e6..6b205b0e 100644 --- a/lib/puppet/provider/glance_image/openstack.rb +++ b/lib/puppet/provider/glance_image/openstack.rb @@ -74,7 +74,7 @@ Puppet::Type.type(:glance_image).provide( @property_hash = { :ensure => :present, :name => attrs[:name], - :is_public => attrs[:visibility].downcase.chomp == 'public'? true : false, + :is_public => attrs[:visibility].downcase.chomp == 'public'? :true : :false, :container_format => attrs[:container_format], :id => attrs[:id], :disk_format => attrs[:disk_format], @@ -100,12 +100,12 @@ Puppet::Type.type(:glance_image).provide( @property_hash.clear end - mk_resource_methods - def is_public - bool_to_sym(@property_hash[:is_public]) + @property_hash[:is_public] end + mk_resource_methods + [ :is_public, :disk_format, @@ -134,7 +134,7 @@ Puppet::Type.type(:glance_image).provide( new( :ensure => :present, :name => attrs[:name], - :is_public => attrs[:visibility].downcase.chomp == 'public'? true : false, + :is_public => attrs[:visibility].downcase.chomp == 'public'? :true : :false, :container_format => attrs[:container_format], :id => attrs[:id], :disk_format => attrs[:disk_format], diff --git a/lib/puppet/type/glance_image.rb b/lib/puppet/type/glance_image.rb index 34c11838..ace48aae 100644 --- a/lib/puppet/type/glance_image.rb +++ b/lib/puppet/type/glance_image.rb @@ -41,14 +41,13 @@ Puppet::Type.newtype(:glance_image) do newproperty(:is_public) do desc "Whether the image is public or not. Default true" newvalues(/(y|Y)es/, /(n|N)o/, /(t|T)rue/, /(f|F)alse/, true, false) - defaultto(true) - munge do |v| - if v =~ /^(y|Y)es$/ + defaultto(:true) + munge do |value| + case value.to_s.downcase + when 'true', 'yes' :true - elsif v =~ /^(n|N)o$/ - :false else - v.to_s.downcase.to_sym + :false end end end