Nick Cammorato
2013-Sep-13 02:30 UTC
[Puppet Users] Refactoring my modules and moving from 2.7.x to 3.3 and have a few questions
Mostly surrounding if there are better(less hackish) ways of doing things. The first is the classic exported resource expiration problem. My existing modules use a wrapper that uses an inline template to call out to Ruby''s Time function, set a timestamp, and set the resource to absent after an expiration period, a cleanup script then runs on the database node and purges exported resources that belong to nodes that would qualify as unresponsive + a grace period of a few days. I see I can now generify this a bit more with create_resources, but Is there a better or built-in way to do this now? The second involves puppet being declarative and the edge cases where you really need it not to be. A lot of times I wound up writing custom providers or lenses to skirt around this, but when that just wouldn''t do(or was overkill), I used a rather hackish wrapper around Puppet::Provider::Collection. I''d either construct the Collection and then evaluate it(when I wanted the resources realized) or do an instance_eval to directly access the private collection method, followed by a map/collect to convert the selected resource into a hash, and return a entirely constructed array composed of said hashes. I was never quite able to figure out how I was supposed to pass in equery/vquery, so I wound up re-implementing those and the whole thing is pretty inefficient and a bit dangerous. All I really need to be able to do is collect say, all exported resources of type foo with target bar into an array so I can iterate through it in some of my templates where a provider is overkill and no lens is available. Is this possible yet, or are we still stuck on never allowing this? Thanks for any replies, --Nick -- 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 post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.