Issue #2021 has been reported by immerda.

----------------------------------------
Bug #2021: Returning boolean not always possible
/issues/2021

Author: immerda
Status: Unreviewed
Priority: Normal
Assigned to: 
Category: binary
Target version: 1.5.4
Complexity: Unknown
Keywords: boolean, return


assume the following code:
<pre>
#cat facter/selinux.rb
Facter.add("selinux") do
    confine :kernel => :linux

    setcode do 
            result = false
        if FileTest.exists?("/selinux/enforce")
            result = true
        end
        result
    end
end
</pre>

one time it is working, the other time not:

<pre>
# export RUBYLIB=`pwd`
# facter selinux
false
# facter
/usr/lib/ruby/site_ruby/1.8/facter/util/confine.rb:37:in `true?': undefined 
method `downcase' for false:FalseClass (NoMethodError)
        from /usr/lib/ruby/site_ruby/1.8/facter/util/confine.rb:36:in `each'
        from /usr/lib/ruby/site_ruby/1.8/facter/util/confine.rb:36:in `true?'
        from /usr/lib/ruby/site_ruby/1.8/facter/util/resolution.rb:101:in 
`suitable?'
        from /usr/lib/ruby/site_ruby/1.8/facter/util/ip.rb:145:in `detect'
        from /usr/lib/ruby/site_ruby/1.8/facter/util/resolution.rb:101:in `each'
        from /usr/lib/ruby/site_ruby/1.8/facter/util/resolution.rb:101:in 
`detect'
        from /usr/lib/ruby/site_ruby/1.8/facter/util/resolution.rb:101:in 
`suitable?'
        from /usr/lib/ruby/site_ruby/1.8/facter/util/fact.rb:72:in `value'
         ... 10 levels...
        from /usr/lib/ruby/site_ruby/1.8/facter/util/collection.rb:103:in 
`to_hash'
        from /usr/lib/ruby/site_ruby/1.8/facter.rb:92:in `send'
        from /usr/lib/ruby/site_ruby/1.8/facter.rb:92:in `to_hash'
        from /usr/bin/facter:125
</pre>

if I debug it I can see that value/values is one time a string and the other 
time a FalseClass or TrueClass

Please note that returning a string isn't possible due to a bug in puppet I'll 
report shortly.

This worked on 1.3.8.


----------------------------------------
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://reductivelabs.com/redmine/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
-~----------~----~----~----~------~----~------~--~---

Reply via email to