resource collectors and rollback question

21 views
Skip to first unread message

Richard

unread,
Sep 30, 2014, 2:21:41 AM9/30/14
to puppet...@googlegroups.com
            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.

jcbollinger

unread,
Sep 30, 2014, 9:29:45 AM9/30/14
to puppet...@googlegroups.com


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

Reply all
Reply to author
Forward
0 new messages