3
votes

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. 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.

1
To peek under the hood, try the --verbose, --debug and --evaltrace switches. - Felix Frank
...which is to say, please do that and provide the output. - Felix Frank
Look into this: I have the same use case (deleting a file after an install), and I am getting notifications from Tidy that the file I'm trying to delete does not exist. I'm getting those notifications well before the point at which, given my sequencing operators and metaparameters, I would expect Tidy to be evaluated. - Chris Owens

1 Answers

0
votes

This is because the resource Tidy for about 5 years didn't support notify mechanisms. https://projects.puppetlabs.com/issues/3924