Paul Nasrat <[email protected]> writes:
> Fix is_virtual fact to return strings rather than bools.
Wouldn't a better way to achieve this be this patch?
diff --git a/lib/facter/util/fact.rb b/lib/facter/util/fact.rb
index e78ed97..e01833b 100644
--- a/lib/facter/util/fact.rb
+++ b/lib/facter/util/fact.rb
@@ -77,6 +77,9 @@ class Facter::Util::Fact
break tmp unless tmp.nil? or tmp == ""
}
+ # Fact values must necessarily be strings, enforce that.
+ @value = @value.to_s
+
unless foundsuits
Facter.debug "Found no suitable resolves of %s for %s" %
[[email protected], @name]
end
That fixes the problem, once, in the right place rather than requiring that
every single end user know this tricky detail. (A warning might also be
appropriate if the value is not a string.)
Otherwise the uninitiated might make the sad and painful discovery of this
themselves by returning false and having to learn that only '' is actually
"not true" as far as puppet is concerned.
Not that I ever broke our entire infrastructure by learning that particular
fact when we were doing work on the bootloader integration or anything.
Daniel
--
✣ Daniel Pittman ✉ [email protected] ☎ +61 401 155 707
♽ made with 100 percent post-consumer electrons
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" 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-dev?hl=en.