Sure ...
Here it is:
#
# terracota_version.rb
#
# Reports terracota version if terracotta is installed
Facter.add(:terracotta_version) do
cmd = %x{/bin/rpm -qa terracotta --queryformat %{VERSION}}
setcode do
if ! cmd.nil?
cmd
else
nil
end
end
end
-frederiko
On Fri, Sep 20, 2013 at 10:25 AM, Ellison Marks <[email protected]> wrote:
> Post the code for the custom fact?
>
>
> On Thursday, September 19, 2013 2:23:15 PM UTC-7, Frederiko Costa wrote:
>>
>> Hi,
>>
>> I've got a facter shipped with a custom module. This factor returns the
>> version of a determined package. It returns nil if the package is not
>> installed yet.
>>
>> When running for the first time, assuming the package is not installed,
>> the facter will be still nil. When referring to that facter in the manifest
>> - for example in a file resource - it fails, because it has been compiled
>> with a nil value. When the package is already installed, it works great.
>>
>> Just out of curiosity, is there any workaround other than if/else
>> statements?
>>
>> Thanks,
>> -frederiko
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/puppet-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.