Sure I can update the wiki - I hope I can save some else time the next time this come up.
I like your suggestion, but I cant quite visualize how I could write a fact that will parse any files in /etc/fact.s and create separate facts from the output. Would I use some sort of loop or will facter parse an array? Thanks Ed > Ahah. So I suggest you try something different. > > * make /etc/facts.d/ > * write a fact that looks for files here, and makes "real" facts based > on the file name and contents. > > Then you can just drop files there and get the same result. > > Do you feel like updating the wiki to point out the limitations with > puppet in daemon mode and the FACTER_* environment variables Edward? > > > > > Thanks again > > > > Ed > > > > On Tue, Nov 9, 2010 at 7:29 PM, Nigel Kersten <[email protected]> > wrote: > >> > >> On Tue, Nov 9, 2010 at 3:45 PM, <[email protected]> > >> wrote: > >> > 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? > >> > >> Most times I've seen people use this functionality has been with > >> puppetd in non-daemon mode. > >> > >> FACTER_foo="woot" puppetd --onetime --verbose --no-daemonize > >> > >> Plus, this works well with standalone "puppet" applying local > >> manifests too. It looks like things aren't so simple in daemon mode. > >> > >> Is there a reason you're not actually doing this as a real fact? > >> > >> > > >> > 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]<puppet-users%[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]<puppet-users%[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]<puppet-users%[email protected]> > . > >> > For more options, visit this group at > >> > http://groups.google.com/group/puppet-users?hl=en. > >> > > >> > >> > >> > >> -- > >> Nigel Kersten - Puppet Labs - http://www.puppetlabs.com > >> > >> -- > >> 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]<puppet-users%[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]<puppet-users%[email protected]> > . > > For more options, visit this group at > > http://groups.google.com/group/puppet-users?hl=en. > > > > > > -- > Nigel Kersten - Puppet Labs - http://www.puppetlabs.com > > -- > 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]<puppet-users%[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.
