【发布时间】:2014-06-29 07:04:59
【问题描述】:
为什么“整洁”资源不删除新条款上的文件。我有以下内容:
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'
],
}
在配置时,matches 属性中指定的文件不会被删除。但是,通过指定“文件”资源,我看到了想要的结果。
$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
}
为什么整洁的资源不删除文件?整洁的资源应该为每个匹配的文件生成一个文件资源。我是在整洁的资源中遗漏了一个属性,还是完全遗漏了这个概念?有什么方法可以查看 tidy 资源生成的文件资源是什么样的?感谢您的任何意见。
【问题讨论】:
-
若要深入了解,请尝试使用
--verbose、--debug和--evaltrace开关。 -
...也就是说,请这样做并提供输出。
-
看看这个:我有同样的用例(安装后删除一个文件),我收到来自 Tidy 的通知,我试图删除的文件不存在。鉴于我的排序运算符和元参数,我希望在评估 Tidy 之前得到这些通知。
标签: puppet