Gavin Williams
2014-Jun-27 11:14 UTC
[Puppet Users] New module - Prefetch provider with @resource params...
Morning All I'm starting to work on a new module[1] to support installation and configuration of Apache Karaf. I've got most of the ground-work laid down, and I'm now starting to work on types and providers to model the various Karaf resources that might need to be managed... The first one on my list is 'feature', which is effectively the Karaf equivalent of a package. I'm trying to write the providers using a prefetch/flush style to make them as efficient as possible, as the aspiration is for Karaf and the Puppet management agent to be run on minuscule hardware, so reducing the processing required as much as possible is essential... Anyhow, enough background, onto the issue... The initial version of my type, provider and provider parent look like [2][3][4]. The 'karaf_feature' provider is using a helper function in 'Puppet::Provider::Karaf' called 'karaf_exec', which tries to use resource param values from the type in it's arguments... What I was aiming to achieve is that the command is executed by Puppet as a specified user, as defined on Line 24 of [4]. However as '@resource' is nil at the point of prefetch call, it's not working :( A sample log of a run is [5]. Now as I'm typing this, I'm thinking that trying to use values from a specific resource on a prefetch call possibly might not ever work... But how else could I model this scenario? Or is prefetching doomed to failure? Any help appreciated. Regards Gavin [1] https://github.com/fatmcgav/fatmcgav-karaf [2] https://github.com/fatmcgav/fatmcgav-karaf/blob/feature/prefetch_flush_providers/lib/puppet/type/karaf_feature.rb [3] https://github.com/fatmcgav/fatmcgav-karaf/blob/feature/prefetch_flush_providers/lib/puppet/provider/karaf_feature/karaf_feature.rb [4] https://github.com/fatmcgav/fatmcgav-karaf/blob/feature/prefetch_flush_providers/lib/puppet/provider/karaf.rb [5] https://gist.github.com/fatmcgav/ca147ef48ac726d1194f -- 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 puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/2b05727c-f984-4c68-ae8b-456d8d8f9989%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.