I''ve created a custom fact to detect whether my server is a physical
box or
a VMware guest, and have the following class:
class server_management {
notice("hw_type=$hw_type")
case $hw_type {
"physical" : { notice("this is a physical system") }
"virtual" : { notice("this is a virtual system") }
default : { warning("the hw_type fact is not present") }
}
}
This class is included in my role_general class, which is included by every
system in my environment. On the test system I have this:
$ facter | grep hw_type
hw_type => virtual
However, when I run puppetd, I never see any notices or warnings. Am I
missing the purpose of these functions? They work fine if they''re used
outside of a class, but I can''t seem to get them to print anything out
as
used above.
$ sudo /usr/sbin/puppetd --onetime --verbose --noop --debug | egrep -i
''virtual|physical|hw_type|notice''
info: Loading facts in hw_type
info: Loading facts in hw_type
notice: Finished catalog run in 9.51 seconds
What am I doing wrong?
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
hello, ----- "James Cammarata" <jimi@sngx.net> wrote:> I''ve created a custom fact to detect whether my server is a physical > box or a VMware guest, and have the following class:Was the included virtual fact not working for you?> class server_management { > notice("hw_type=$hw_type") > case $hw_type { > "physical" : { notice("this is a physical system") } > "virtual" : { notice("this is a virtual system") } > default : { warning("the hw_type fact is not present") } > } > } > > However, when I run puppetd, I never see any notices or warnings. Am I > missing the purpose of these functions? They work fine if they''re used > outside of a class, but I can''t seem to get them to print anything out > as used above.Functions get executed at compile time on the master, you''ll probably see logs there. To log on the client do: notify{"hw_type=${hw_type}": } -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
> Functions get executed at compile time on the master, you''ll probably see > logs there. > > To log on the client do: > > notify{"hw_type=${hw_type}": }I see it in the puppet master''s log: Sep 13 13:27:32 myserver puppetmasterd[6650]: (Scope(Class[server_management])) hw_type=virtual Sep 13 13:27:32 myserver puppetmasterd[6650]: (Scope(Class[server_management])) this is a virtual system Thanks for the tip on client logging, that''s what I was looking for. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.