On Thursday, August 9, 2012 2:10:46 PM UTC-5, BeastMode wrote:
>
> I created a custom fact that determines what class of server it is based 
> off the first 3 letters of the hostname: tst, qa, stg, prd, dev.... The 
> fact tested fine and shows in the list when running "facter -p". I wanted 
> to use the fact in a class to determine if zabbix-agent should be removed 
> or installed. I want to remove from servers that currently have zabbix 
> installed in groups tst, dev and qa. For some reason this doesn't work at 
> all. It doesn't error out but doesn't do anything. Every time I run puppet 
> or even debug it just finishes like nothing has changed. Can you please 
> tell me what I'm doing wrong? My test machine is in the 'tst' server class 
> so in theory puppet should more the zabbix-agent package. Thanks - Chris
>
>
> class zabbix {
>
>         class client {
>     $module_name = "zabbix"
>
>     if $datacenter == 'boston' {
>         $zabbix_server = 'yoda.enernoc.net'}
>     else {
>         $zabbix_server = 'vader.enernoc.net'}
>
> # Determine server class. Remove agent from qa, tst and dev server classes
> if (( $server_class == 'qa[a-z0-9]' ) or ( $server_class == 'tst' )  or  ( 
> $server_class == 'dev' )) {
>

Well, the 'qa[a-z0-9]' bit probably isn't going to do what you want.  At 
least, it looks like you wanted to test a regex match, but you wrote an 
equality test instead.

Also, it is best to use fully-qualified names.  Custom facts are in the top 
namespace, so their fully-qualified names look like "$::server_class".

You could also drop this in to make sure that your fact values are actually 
what you expect:

notify { 'server_class':
  message => "my class is '$::server_class'"
} 



John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/wzI8igwkkucJ.
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