Custom facts problem

Hello,

I've a problem with the my custom fact below.
When the registry_key doesn't exist, ma fact doesn't exist but I want my
fact = "null".
How i can do this ??

require 'facter'

*Facter.add(:cf_ocs_inv_version) do confine :kernel => :windows setcode
do require 'facter/util/registry' ocs_version = "null" regvalue

··· = Facter::Util::Registry.hklm_read('SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OCS Inventory Agent', 'DisplayVersion') ocs_version = regvalue if regvalue if ocs_version != "" "#{ocs_inv_version}".chomp else "null" end endend*

Thanks

Please use pastebin to paste the code.

Looks like more puppet question, try puppet-users list?

LZ

··· On Thu, Mar 06, 2014 at 04:10:27AM -0800, billbok29 wrote: > Hello, > > I've a problem with the my custom fact below. > When the registry_key doesn't exist, ma fact doesn't exist but I want my > fact = "null". > How i can do this ?? > > *require 'facter'* > > > > > > > > > > > > > > *Facter.add(:cf_ocs_inv_version) do confine :kernel => :windows setcode > do require 'facter/util/registry' ocs_version = "null" regvalue > = > Facter::Util::Registry.hklm_read('SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OCS > Inventory Agent', 'DisplayVersion') ocs_version = regvalue if > regvalue if ocs_version != "" "#{ocs_inv_version}".chomp > else "null" end endend* > > > Thanks > > > -- > You received this message because you are subscribed to the Google Groups "Foreman users" group. > To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+unsubscribe@googlegroups.com. > To post to this group, send email to foreman-users@googlegroups.com. > Visit this group at http://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/groups/opt_out.


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman