ok - that makes sense, but why does facter have a feature http://docs.puppetlabs.com/guides/faq.html#can-i-access-environmental-variables-with-facter where you can expose environmental variables as facts if puppet will not recognize the facts? Is the issue because of the old version of facter I am using?

Thanks

Ed

On Nov 9, 2010 5:45pm, Zach Leslie <[email protected]> wrote:
Hi Ed,

You are correct that the environment will not get imported into puppet. When you restart the puppet daemon, you are missing your custom fact because daemon will run as its own process with its own environment, so just exporting the variable will only effect your current running environment and not the puppet daemon environment. As such, the behavior your are seeing is expected.


Looking around, I think this looks like a better way to get facts in: http://projects.puppetlabs.com/projects/1/wiki/Adding_Facts

This will allow you to get some level of synchronization of your custom facts from your master to your clients in a much cleaner way.


Hope this helps.

Zach


On Mon, Nov 8, 2010 at 5:42 PM, Edward Bailey [email protected]> wrote:

I am having a great deal of trouble using a custom fact in a module and I am hoping someone can help me out.


I am using facter-1.5.0-2.el4 and puppet-0.24.5-1.el4. I know these are really old versions.

The custom fact is defined using an environmental variable


export FACTER_VERTICAL="dev fit"

and I can see the fact in the output of facter

[xxxxx ~]# facter | grep -i vertical
vertical => dev fit

In the module I am trying to use the fact in the following way



file { "/etc/yum.repos.d/env32-envision.repo":
ensure => present,
mode => 0664,
owner => root,
group => root,


content => $vertical ? {
"dev fit" => template("ads_yum2/env32-dev-fit.repo.erb"),
default => template("ads_yum2/env32-dev-staging.repo.erb"),


require => File["/etc/yum.repos.d/base_os.repo"],
}
}

When I restart puppet the output is the default option instead of the "dev fit" option. If I run puppet interactively "puppetd --debug --test" I get the correct output based on the custom fact. I understand that puppet will not inherent environmental variables but since the fact is present I thought this approach would work. Am I wrong?



I have been banging my head against the wall over this for some time. I appreciate any input.

Thanks

Ed





--

You received this message because you are subscribed to the Google Groups "Puppet Users" 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-users?hl=en.






--
Zach
[email protected]








--

You received this message because you are subscribed to the Google Groups "Puppet Users" 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-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 [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-users?hl=en.

Reply via email to