Hi Shawn, This is very much possible, but the implementation is going to be a true hack that pollutes the global namespace until https://tickets.puppetlabs.com/browse/PUP-4002 is fixed.
Ideally, it would be something that is GC'd with the catalog, but we'll see where things go. I've done this both for IPTables and CGroups in the following modules mainly because any error in the application of their chain would be a disaster so we wanted to wait until we could check everything and apply them seamlessly to the system. https://github.com/simp/pupmod-simp-iptables https://github.com/simp/pupmod-simp-cgroups The CGroups example is going to be MUCH easier to follow. Essentially, I create a class variable that compiles the end result and then executes it on the last resource in the catalog. The last resource in the catalog is detected by counting what resource you're on against the total number of that resource type in the catalog. The main downside to this (besides the global namespace nastiness) is that you only see the last resource in the catalog change in your report. Not ideal, but certainly functional. Make sure that you undef the class parameter at the end of your application so that you don't end up with memory leaks. Trevor On Wed, Jan 27, 2016 at 1:50 PM, Shawn Ferry <shawn.fe...@oracle.com> wrote: > I have a command that takes one or more effectively free form arguments > and executes somewhat slowly and sometimes if things are changing much more > slowly. Lets say 30s nominal execution in the simple case. > > I’m not finding a list of hooks to see if anything is appropriate. Flush > would be great if I was processing a bunch of individual arguments for a > resource but I need something that allows me to defer these updates until > the end of processing for a provider and flush them together. > > Am I missing an alternate method to do something like this or the correct > place in the docs? > > > Thanks > Shawn > > > If I have something like the following it takes at least 2 minutes > > slow_command { [‘thing1’, 'thing2', ‘thing3’, ’thing4']: > value => true > } > > /tmp/slow_command thing1=true > /tmp/slow_command thing2=true > /tmp/slow_command thing3=true > /tmp/slow_command thing4=true > > If I manually invoke or exec it it takes 30s > > /tmp/slow_command thing1=true thing2=true thing3=true thing4=true > > > :::slow_command::: > #!/bin/sh > sleep 30 > echo $* > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-dev+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-dev/9D1DB354-8D30-448E-A461-54C67D4B8B26%40oracle.com > . > For more options, visit https://groups.google.com/d/optout. > -- Trevor Vaughan Vice President, Onyx Point, Inc (410) 541-6699 -- This account not approved for unencrypted proprietary information -- -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/CANs%2BFoXa%2BDS3O4UP3PkBCYHwe385hSbemc122akg1JYRFpL2zw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.