The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com
providers should have a finalize class method
|Affected Puppet version:||3.2.3||Branch:||https://github.com/puppetlabs/puppet/pull/1851|
Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com
This issue is currently not available for export. If you are experiencing the issue described below, please file a new ticket in JIRA. Once a new ticket has been created, please add a link to it that points back to this Redmine ticket.
For providers that serve as a proxy, it makes sense to open all connections and set up all dependencies in the self.prefetch method. This requires an additional method that is called once per class instance where these connections can be closed. Something like self.finalize (borrowing from Java terminology)
#9 Updated by Nigel Kersten over 2 years ago
- Status changed from Needs Decision to Needs More Information
- Assignee changed from Nigel Kersten to Dan Bode
I want a little more info about what benefit this brings. Not a huge design document, but more of a concrete sense of what it does for developers/users.
#10 Updated by Dan Bode over 2 years ago
the use case that I was considering is resources that are applied through some kind of web service. (like ec2)
self.instances/self.prefetch give us a pretty clear place to establish a single connection that can be used throughout the catalog application (as opposed to reestablishing a connection for every resource). If we implement this pattern, however, there is no place to handle shutting down the connection.
A more questionable use case may be something like sysctl, where resources are managing a file, but the settings still need to be loaded into memory (I am less certain if this is a valid use case)
#11 Updated by Nigel Kersten over 2 years ago
- Status changed from Needs More Information to Accepted
- Assignee deleted (
I’m not quite seeing the sysctl case, I simply implemented this as a parameter (whether or not you wanted the file settings to be actively loaded into memory) on each setting.
The other is good though. Thanks Dan.
#12 Updated by Trevor Vaughan about 1 year ago
- Affected Puppet version changed from 0.25.4 to 3.2.3
This is still an issue and is now being found by multiple users as time moves on.
Posting this for reference https://groups.google.com/forum/#!topic/puppet-dev/Iqs5jEGfu_0
And yes, I would love to have it too. Right now I’m resorting to horrible hacks by counting resources.
However, the BIGGEST feature that I would like to see is the ability to have two different finalize class methods. One if all parents in the tree succeeded and one if they failed.
#16 Updated by Adrien Thebo 10 months ago
- Status changed from In Topic Branch Pending Review to Merged - Pending Release
- Target version set to 3.4.0
Merged into master in af5fb2f; this should be released in 3.4.0. With respect to the method name chosen, see https://groups.google.com/forum/#!topic/puppet-dev/2blbxCo5pzg.