简体   繁体   English

傀儡:为什么整洁的资源不起作用

[英]puppet: why does tidy resource not work

Why isn't the "tidy" resource removing files on a new provision. 为什么“整洁”资源不能删除新规定上的文件。 I have the following: 我有以下内容:

package {'apache2':
  ensure => present,
  before => [
    File["/etc/apache2/apache2.conf"],
    File["/etc/apache2/envvars"]
  ],
}->
#Remove the conf files in the conf.d directory except the charset.
tidy { 'tidy_apache_conf':
  path    => '/etc/apache2/conf.d/',
  recurse => 1,
  backup  => true,
  matches => [
    'localized-error-pages',
    'other-vhosts-access-log',
    'security'
 ],
}

On provisioning the files specified in the matches attribute aren't removed. 在配置时,不会删除matches属性中指定的文件。 However by specifying a "file" resource, I see the desired results. 但是,通过指定“文件”资源,我看到了所需的结果。

$unwanted_apache_conf = [
  '/etc/apache2/conf.d/localized-error-pages',
  '/etc/apache2/conf.d/other-vhosts-access-log',
  '/etc/apache2/conf.d/security'
]

package {'apache2':
  ensure => present,
  before => [
    File["/etc/apache2/apache2.conf"],
    File["/etc/apache2/envvars"]
  ],
}->
file { $unwanted_apache_conf:
  ensure => absent
}

Why isn't the tidy resource removing the files? 为什么整理资源不能删除文件? The tidy resource should be generating a file resource for each file matched. 整洁的资源应该为每个匹配的文件生成文件资源。 Am I missing an attribute in the tidy resource, or just missing the concept entirely? 我是否在整洁的资源中遗漏了一个属性,或者完全错过了这个概念? Is there any way to see what the file resources the tidy resource is generating look like? 有什么方法可以看到整洁资源生成的文件资源是什么样的? Thanks for any input. 感谢您的任何意见。

This is because the resource Tidy for about 5 years didn't support notify mechanisms. 这是因为资源Tidy大约5年不支持通知机制。 https://projects.puppetlabs.com/issues/3924 https://projects.puppetlabs.com/issues/3924

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM