傀儡服务不停止服务

notice ("This should be echoed") service { "iptables": ensure => "stopped", } 

这并不能阻止iptables,我不知道为什么。 service iptables stop工作正常。 Puppet 2.6.17在CentOS 6.3上。

更新:
/etc/puppet/manifests/nodes.pp

  node 'linux-dev' { include mycompany::install::apache::init include mycompany::config::services::init } 

/etc/puppet/modules/mycompany/manifests/config/services/init.pp

 class mycompany::config::services::init { if ($::id == "root") { service { 'iptables': #name => '/sbin/iptables', #enable => false, #hasstatus => true, ensure => stopped } notice ("IPTABLES is now being stopped...") file { '/tmp/puppet_still_works': ensure => 'present', owner => root } else { err("Error: this manifest must be run as the root user!") } } 

这是不同的iptables,因为没有守护进程,它不是像crond守护进程的例子。 服务types将在进程表中查找进程名称“iptables”,如果不在那里则认为进程已停止。 添加'hasstatus => true',它会工作。 EDITED:status =>“true”,这个工作通常是手动为types服务提供的,如果服务正在运行,则该命令必须返回0,否则返回非零值。

 notice ("This should be echoed") service { "iptables": ensure => "stopped", hasstatus => "true", status => "true", 

}