Hi,

Facter value is not reflecting in puppet manifest.

Along with books ProPuppet and "Puppet 2.7 Cookbook", I am referring to
following links:
http://docs.puppetlabs.com/guides/custom_facts.html
http://projects.puppetlabs.com/projects/1/wiki/Adding_Facts
http://docs.puppetlabs.com/guides/plugins_in_modules.html
http://www.puppetcookbook.com/posts/select-a-file-based-on-a-fact.html
http://docs.puppetlabs.com/guides/faq.html#how-do-all-of-these-variables-like-operatingsystem-get-set
http://groups.google.com/group/puppet-users/browse_thread/thread/8b2424f5347bbcc7/c2af30e123c92e91

For my test set-up I have 2 ec2 instances, one puppet master and one puppet
agent. Both instances have Ubuntu 10.04 and have following version of
puppet and facter:
root@master:~# puppet --version
2.7.9
root@master:~# facter --version
1.6.4

On master /etc/puppet/puppet.conf has
plugindest = /var/lib/puppet/lib
pluginsource = puppet://puppet/plugins
pluginsync = true

I tried hardcoding pluginsource to fqdn of puppet master, but it didn't
work. Also 'puppet master --genconfig | grep plugin' also gaves same
results as puppet.conf.

On master I have my change.erb on
modulepath/module_name/lib/facter/change.rb as well as
on /var/lib/puppet/lib/facter/change.erb. At both places it has execute
permissions.

change.erb looks like:
Facter.add("change") do
  setcode do
    Facter::Util::Resolution.exec(%q<su - ubuntu -c "cd '/tmp/bloomspot/';
hg parent | head -1 | awk -F: '{print \$NF}'">).chomp
  end
end

My manifests looks like:
  exec { 'copy-code':
    command => "mkdir /tmp/$change",
    user    => 'root',
    path    => "/usr/bin",
    cwd     => '/tmp',
    logoutput => true,
  }

Snippet of client log after running puppet agent:
Feb  7 20:08:14 ip-10-12-59-93 puppet-agent[1766]:
(Exec[copy-code](provider=posix)) Executing 'mkdir /tmp/ '
Feb  7 20:08:14 ip-10-12-59-93 puppet-agent[1766]: Executing 'mkdir /tmp/ '
Feb  7 20:08:14 ip-10-12-59-93 puppet-agent[1766]:
(/Stage[main]/Codebaserel/Exec[copy-code]/returns) executed successfully
Feb  7 20:08:14 ip-10-12-59-93 puppet-agent[1766]:
(/Stage[main]/Codebaserel/Exec[copy-code]) The container Class[Codebaserel]
will propagate my refresh event
Feb  7 20:08:14 ip-10-12-59-93 puppet-agent[1766]: (Class[Codebaserel]) The
container Stage[main] will propagate my refresh event
Also, in puppet logs I don't see anything mentioned about the fact being
pulled/pushed to client.

On client, after setting RUBYLIB and copying changeset.erb in
$RUBYLIB/facter, I confirmed that script can run fine on the client:
root@agent:~# facter -p | grep -i change
change => d65575bc8f5f
root@agent:~# facter -p change
d65575bc8f5f
root@agent:~# facter change
d65575bc8f5f

Manually ruby script is running fine on the agent. Rest of the puppet
modules are running fine. All the required configs seems to have
appropriate value.
What am I missing? Any pointer/suggestions would be helpful.

Thanks for attention.

-Ashish

-- 
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