On Tuesday, September 30, 2014 1:21:41 AM UTC-5, Richard wrote: > > I want to remove all influences have been produced by puppet > script when the agent failed in executing catalog. so i think if i can use > resource collectors to collect all the resource using some tag then change > the property ensure. Then delete all resources in order : first i stop all > service ,then i delete all file ,then delete all directory ,then i > uninstall package. I don't know whether this method will work. >
I'm sorry, but Puppet does not support that. It is not transactional, and it never could be. The main problem is that the nature of some resources simply does not accommodate reversion. The poster child for this is Exec: once an Exec's command has run, you cannot un-run it. A secondary problem is that there are so many ways that a given resource could be out of sync before the start of the run. Puppet does not memorialize resources' starting state, and even if it did, it is generally not possible to describe the needed details of a reversion via a single parameter. You can approximate what you request in VMs that support snapshotting by taking a snapshot before the start of each Puppet run, and reverting to that snapshot if any resources fail. Even that is not a complete reversion, however, because even failed Puppet runs have effects outside the client machine. At minimum they effect changes at the Puppet master, but they can have wider effects, too. Similarly, you can achieve what you request with respect only to the filesystem if you use a filesystem that support snapshotting (e.g. LVM, if configured for it). Understand, too, that this isn't fundamentally a Puppet issue. Overall computer systems simply are not transactional. You can never go back. *In any event*, your idea to use collectors as a mechanism to achieve your objective would not work anyway. Collectors are evaluated as part of the process of building the target node's catalog, before any resources are applied. By the time you find out that a resource has failed, it is too late to modify the catalog. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/03f82c9a-1279-40f6-b78d-39ee3ed42e10%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
