Fix puppet 8 compatibility of nova_flavor

Fix the following error detected by puppet 8.

Munging failed for value true in class is_public: undefined method `=~'
for true:TrueClass ...

Change-Id: I7d078ea72c5c1c4898247f61422986f277ee9a98
This commit is contained in:
Takashi Kajinami 2024-05-31 15:04:41 +09:00
parent 2c0c052297
commit 8593d289d1

View File

@ -115,10 +115,14 @@ Puppet::Type.newtype(:nova_flavor) do
newvalues(/(y|Y)es/, /(n|N)o/, /(t|T)rue/, /(f|F)alse/, true, false) newvalues(/(y|Y)es/, /(n|N)o/, /(t|T)rue/, /(f|F)alse/, true, false)
defaultto(true) defaultto(true)
munge do |v| munge do |v|
if v =~ /^(y|Y)es$/ if v.is_a?(String)
:true if v =~ /^(y|Y)es$/
elsif v =~ /^(n|N)o$/ :true
:false elsif v =~ /^(n|N)o$/
:false
else
v.to_s.downcase.to_sym
end
else else
v.to_s.downcase.to_sym v.to_s.downcase.to_sym
end end