Issue #17519 has been reported by Nan Liu.
----------------------------------------
Bug #17519: Puppet type and provider handling of boolean values.
https://projects.puppetlabs.com/issues/17519
Author: Nan Liu
Status: Unreviewed
Priority: Normal
Assignee: Henrik Lindberg
Category:
Target version:
Affected Puppet version:
Keywords:
Branch:
So I have no idea why we convert boolean values to the symbol :true, :false,
and this is making things a bit painful when writing puppet providers.
First, I'm not sure why this is necessary before we can even use true, false:
newproperty(:example) do
newvalues(:true, :false)
end
Without this, the built in insync? always evaluate true. Once we added
newvalues(:true, :false), we have to compare against symbol :true:
/Stage[main]//Notify[trigger]/message: current_value absent, should be
trigger (noop)
/Stage[main]//Demo[ntpd]/running: current_value TrueClass true, should be
Symbol :true (noop)
Class[Main]: Would have triggered 'refresh' from 3 events
Stage[main]: Would have triggered 'refresh' from 1 events
Finished catalog run in 2.00 seconds
So far these work around doesn't work and they are both wat?:
* munge gets evaluated before whatever internal process changes the value to
symbol :true, :false.
* insync? is not called if the value is :true, :false, so we can't change the
comparison behavior.
You'll find these code examples in puppet provider comparing against the symbol
true:
* @resource[:hasrestart] == :true
* if resource[:type_check] == :true
I'm curious why in the world we don't just treat them as booleans and instead
as symbols and why we have do these special comparisons.
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.