On 08/26/2014 08:38 AM, Mickaël Canévet wrote:
>
> Well, actually no. I'd really like to be able to provide a monkey patch
> that will apply on top of puppetlabs's module so that I don't have to
> maintain a fork (which is what I do right now) while my patch is not
> accepted upstream.
> As declaring a parent for a puppet type is obsolete, I can't use
> inheritance to do that, that's why I was wondering if monkey patching
> could do the trick.
Yes, that patch looks a mite problematic ;-)
Apparently you can indeed monkeypatch stuff.
irb(main):001:0> require 'puppet'
irb(main):012:0> class Puppet::Type::File
irb(main):013:1> autorequire :package do |res|
irb(main):014:2* 'coreutils'
irb(main):015:2> end
irb(main):016:1> end
=> #<Proc:0x000000037af7d0@(irb):13>
It might be tricky to get Ruby to load your code at an appropriate time,
but It Should Work.
Quick reminder that I grant no warranty for the well-being of your
firewalls ;-)
Cheers,
Felix