Ask Your Question
0

tidy not remove files

asked 2017-06-07 10:47:34 -0500

mouna gravatar image

Hello,

I 'd like to remove the file calcul-version.tar.gz and I can't use either exec or file resources. ( I can't use file resource because I have install this file with ensure= present and I'd like to remove it after install )

I use :

  tidy { 'Remove calcul' :
      path    => "/${::service}/at",
      recurse => 1,
      matches => [ 'calcul-*.tar.gz' ],
    }
  }

But tidy doesn't remove calcul-version.tar.gz.

Any help please ?

Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-07-09 06:37:20 -0500

If you read the description of the tidy resource carefully, you'd know why:

This resource type works by generating a file resource for every file that should be deleted and then letting that resource perform the actual deletion.

So tidy attempts to create a file resource for every matching path. Since you already distribute your *.tar.gz file via a file resource, a file resource already exists. Since its ensure attribute is already defined as being present, tidy doesn't overwrite that. Hence you can't achieve your desired behavior (like this).

Remember: A Puppet catalog compilation results in a final state. There's no jumping around, back and forth, during catalog application (at least it isn't meant to be).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2017-06-07 10:47:34 -0500

Seen: 201 times

Last updated: Jul 09