Hi,
I developed a custom facter and distributed with plugin sync successfully,
but can not get the value from site.pp
The new facter called "servertype", which is working fine with facter
command.
# facter -p servertype
webserver
But can not work in site.pp:
# cat site.pp
notify{"Server type : ${::servertype}, osfamily : ${::osfamily}": }
# puppet agent -tv
info: Retrieving plugin
info: Caching catalog for ci13sjppm01.webex.com
info: Applying configuration version '1365961809'
notice: Server type : , osfamily : RedHat
notice: /Stage[main]//Notify[Server type : , *osfamily : RedHat*]/message:
defined 'message' as 'Server type : , osfamily : RedHat'
notice: Finished catalog run in 0.17 seconds
You can see the ${::servertype} in site.pp is empty, but ${::osfamily} is
working fine.
The code of custom facter likes this:
# cat servertype.rb
Facter.add(:servertype) do
setcode do
Facter::Util::Resolution.exec("cat /etc/servertype")
end
end
The directory structure on puppet master likes the following:
[root@ci13sjppm01 custom]# pwd
/etc/puppet/modules/custom
[root@ci13sjppm01 custom]#
[root@ci13sjppm01 custom]# ls -lR
.:
total 8
drwxr-xr-x 3 puppet puppet 4096 Apr 14 16:58 lib
drwxr-xr-x 2 puppet puppet 4096 Apr 14 17:01 manifests
./lib:
total 4
drwxr-xr-x 2 puppet puppet 4096 Apr 14 17:05 facter
./lib/facter:
total 4
-rwxr-xr-x 1 puppet puppet 108 Apr 14 16:53 servertype.rb
./manifests:
total 0
-rwxr-xr-x 1 puppet puppet 0 Apr 14 17:01 init.pp
Regards,
Autumn
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" 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-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.