Hi,

What I do is a little different for zmanda.

I have a fact that looks for a local release file that contains the version 
number installed. If that file doesn't exist then it returns 0.0.0.

The version file is created after the successful install.

I thought the gem provider was  anyway? Can't you pass the version in the 
package declaration?

Cheers,
Den

On 25/06/2011, at 8:12, Craig White <craig.wh...@ttiltd.com> wrote:

> Perhaps my logic isn't that good here and I shouldn't be using a custom fact 
> at all but what I am trying to do is ascertain which version of the passenger 
> gem is actually installed because I need to reference it in various places in 
> apache & nginx configuration (the specific location of the passenger binary).
> 
> but my erb fails because the fact $passenger_version hasn't been created yet.
> 
> so I tried...
> 
>     file {"/etc/apache2/mods-enabled/passenger.load":
>           ... snip ...
>        require  => Facter["datacenter"],
>      }
> 
> and in /etc/puppet/modules/custom/lib/facter/datacenter.rb I have
> 
> Facter.add("datacenter") do
>  setcode do
>    datacenter = "unknown"
>    # Get current ip address from Facter's own database
>    ipaddr = Facter.value(:ipaddress)
>      ... snip ...
>    datacenter
>  end
> end
> #
> # Provide an additional 'passenger_version' fact
> # to use in apache & nginx modules
> #
> 
> Facter.add("passenger_version") do
>  setcode do
>    passenger_version = "unknown"
>    exec('/usr/local/bin/passenger --version > /tmp/passenger_version')
>    passenger_version = "File.open('/tmp/passenger_version', 
> &:readline).chomp.split(' ').last"
>    passenger_version
>  end
> end
> 
> but it never seems to add the 'passenger_version' fact
> 
> 1. How can I make sure that the fact is ascertained before the template file 
> is parsed?
> 
> 2. If I am setting up a new system, passenger won't be installed until some 
> point in the declarative process and at that point, how would I ensure that 
> the fact is ascertained?
> 
> Thanks
> 
> -- 
> Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  craig.wh...@ttiltd.com
> 1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com 
> 
> Need help communicating between generations at work to achieve your desired 
> success? Let us help!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to