什么木偶资源types需要一个审计元参数来强制傀儡pipe理资源,如果它被删除?

直到最近,我还是觉得仅仅声明一个具有各种属性的资源就可以确保Puppetpipe理资源,并且如果它改变了就会回到configuration状态。

今天,我发现不是我configuration的yumrepo资源的情况,直到我添加了audit => all metaparameter资源。 我删除了/etc/yum.repos.d/foo.repo并运行puppetd --test木偶没有重新创build资源。 这是否表明木偶瑕疵?

如果这就是预期的行为,那么它会引发一个问题,那么其他什么资源需要audit => all告诉Puppetpipe理资源的状态,如果它在pipe理下的系统上发生变化呢?

这里是库类:

 class yum::therepo { # Temporarily remove the Yum repo configuration if we don't have # httpd yet. exec { 'disable-the-repo-to-get-its-dependencies': provider => shell, command => 'rm -f /etc/yum.repos.d/the.repo', unless => 'rpm -q httpd', onlyif => 'test -f /etc/yum.repos.d/the.repo', before => [Package['httpd'], Exec['httpd-for-yum'],], path => '/bin:/usr/bin', } # Ensures httpd is running as a Yum server before anything else # tries to install packages from it. exec { 'httpd-for-yum': provider => shell, command => '/sbin/service nginx stop || true ; /sbin/service httpd restart', require => Class['yum::server'], } yumrepo { "the": require => [Exec['httpd-for-yum'],], descr => "The YUM Repo", baseurl => "http://yum/repos/redhat/5/x86_64/", gpgcheck => "0", enabled => "1", # One puppet run failed to recreate the.repo. I added audit # => all, and the next puppet run did recreate the.repo. # Possibly a red herring. I'd like to understand why it # worked in one case and not in the other. #audit => all, } } 

而Yum服务器类:

 class yum::server { include httpd include iptables package { ['createrepo']: ensure => present; } exec { 'update-repo-metadata': require => [ Package['createrepo']], cwd => '/var/www/html/yum', command => '/usr/bin/createrepo --update -d repos/redhat/5/x86_64/', creates => '/var/www/html/yum/repos/redhat/5/x86_64/repodata/repomd.xml', } file {'/etc/httpd/conf.d/yum.conf': ensure => file, mode => 0644, source => "puppet:///modules/yum/yum_httpd.conf", require => Package['httpd'], notify => Service['httpd'], } } 

我认为你误解了审计标志,但是你可以发布你的yum资源部分,因为这很有帮助。 通常,不,您不需要在yumrepo资源上进行审计,以使其创build一个.repo文件。

http://puppetlabs.com/blog/all-about-auditing-with-puppet/

创build大多数没有ensure属性的Puppet资源types是未定义的行为。 当然,木偶知道资源,但不知道最终状态应该是什么,木偶无法做任何有用的事情。

作为一个例子,尝试puppet apply下面的代码片段:

 file { '/testfile': }