木偶重启服务两次 – 可以修复吗?

当服务描述既ensure => running并订阅configuration文件的变化,如果两个条件都满足(即它没有运行,configuration文件改变)它得到(重新)启动两次 。 有没有办法让它只启动一次?

为了澄清,我有以下types:

  service { "puppet": ensure => running, enable => true, hasrestart => true, subscribe => File["/etc/puppet/puppet.conf"], } # service 

两个 /etc/puppet/puppet.conf被更改,服务木偶没有运行时,我在puppet输出中看到以下内容(使用–debug指定):

 .... debug: /Stage[main]/Puppet/Service[puppet]/subscribe: subscribes to File[/etc/puppet/puppet.conf] notice: /Stage[main]/Puppet/File[/etc/puppet/puppet.conf]/content: content changed '{md5}c39350dd1e135cf9fffd14ff167d6655' to '{md5}845a4aac5e83ab3f8cd9efd80ce17772' .... info: /etc/puppet/puppet.conf: Scheduling refresh of Service[puppet] debug: /etc/puppet/puppet.conf: The container Class[Puppet] will propagate my refresh event info: /etc/puppet/puppet.conf: Scheduling refresh of Service[puppet] debug: Service[puppet](provider=debian): Executing '/etc/init.d/puppet status' debug: Service[puppet](provider=debian): Executing '/etc/init.d/puppet start' notice: /Stage[main]/Puppet/Service[puppet]/ensure: ensure changed 'stopped' to 'running' debug: /Stage[main]/Puppet/Service[puppet]: The container Class[Puppet] will propagate my refresh event debug: Service[puppet](provider=debian): Executing '/etc/init.d/puppet status' debug: Service[puppet](provider=debian): Executing '/etc/init.d/puppet restart' err: /Stage[main]/Puppet/Service[puppet]: Failed to call refresh: Could not restart Service[puppet]: Execution of '/etc/init.d/puppet restart' returned 1: at /etc/puppet/modules/puppet/manifests/init.pp:32 

这显然失败,因为以下几点:

 root:~# /etc/init.d/puppet restart ; /etc/init.d/puppet restart * Restarting puppet agent [ OK ] * Restarting puppet agent [fail] 

有办法解决这个问题吗?

Puppet IRC频道回答了我的问题。

这是一个木偶的错误,这里描述: http : //projects.puppetlabs.com/issues/show/9656

我现在远离我的木偶安装,但有几件事情:

  1. 你正在运行什么版本的木偶?
  2. 当我忘记把“hasstatus => true”添加到我的服务中时,总有一些有趣的事情发生在我身上。 它可能无法解决你的问题,但它不应该伤害任何东西。