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)
defaultto(true)
munge do |v|
if v =~ /^(y|Y)es$/
:true
elsif v =~ /^(n|N)o$/
:false
if v.is_a?(String)
if v =~ /^(y|Y)es$/
:true
elsif v =~ /^(n|N)o$/
:false
else
v.to_s.downcase.to_sym
end
else
v.to_s.downcase.to_sym
end