On 1/13/2014 5:51 AM, Denis Kot wrote:
I have the following classes:
class zabbix-agent {
...
package {'zabbix-agent':
ensure => installed
}
...
service { "zabbix-agent":
ensure => running,
start => "/etc/init.d/zabbix-agent start",
stop => "/etc/init.d/zabbix-agent stop",
status => "/etc/init.d/zabbix-agent status",
restart => "/etc/init.d/zabbix-agent restart",
require => Package['zabbix-agent']
}
}
class redis {
...
file {"/etc/zabbix/zabbix_agentd.conf.d/redis.conf":
source => "puppet:///modules/redis/redis_monitoring.conf",
require => Package['zabbix-agent'],
notify => Service['zabbix-agent']
}
...
}
node /^data\d+\.example\.com$/ inherits 'prerun'
{
class 'redis'
}
node 'prerun' {
...
class {'zabbix-agent': stage => pre}
...
}
but that code produces error:
err: Could not apply complete catalog: Found dependency cycles in the
following relationships: Service[zabbix-agent] =>
File[/etc/redis/redis.conf], Package[redis-server] =>
File[/etc/redis/redis.conf], Service[zabbix-agent] => Class[Settings],
Service[zabbix-agent] => File[/etc/puppet/puppet.conf],
File[/etc/zabbix/zabbix_agentd.conf.d/redis_monitoring.conf] =>
Service[zabbix-agent], Service[zabbix-agent] =>
File[/etc/zabbix/zabbix_agentd.conf.d/redis_monitoring.conf],
Service[zabbix-agent] => File[/etc/puppet/auth.conf],
Service[zabbix-agent] => Class[prerun], File[/etc/redis/redis.conf] =>
Service[redis-server], Service[zabbix-agent] => Service[redis-server],
Service[zabbix-agent] => Package[redis-server], Service[zabbix-agent] =>
File[/etc/puppet/namespaceauth.conf], Service[zabbix-agent] =>
Class[datad.leaderboard.lvis.tv]; try using the '--graph' option and
open the '.dot' files in OmniGraffle or GraphViz
what's wrong? if I comment out 'notify' puppet doesn't complain, but
doesn't restart service too.
Stages should be treated as black boxes where you assume everything that
was suppose to happen in an earlier stage has already happened. You can
not notify to any resources from a resource in a later stage. And it's a
bad idea to refer to any resources between any stage as you're almost
guaranteed to cause dependency cycles. This is why stages are only used
for a small subset of problems.
In your case I don't see any reason for zabbix to be in a stage. No
point in monitoring being up before the services it needs to monitor.
Remove stage => when you declare it and you should be fine though you
might need to fix ordering afterwards.
Ramin
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/52D412CC.6070901%40badapple.net.
For more options, visit https://groups.google.com/groups/opt_out.