On Wed, Sep 17, 2014 at 6:48 AM, Karolis Pabijanskas <
[email protected]> wrote:
>
> I have a custom type and provider that are depending on a rest-client gem.
>
> After the pluginsync, when providers get loaded, I do this to avoid it
> failing:
>
>  30 begin
>  31   require 'rest-client'
>  32 rescue LoadError => e
>  33   Puppet.info "You need the `rest-client` gem for this to work."
>  34 end
>
>
> The rest-client is not present before the run, thus I get an Info message:
> "Info: You need the `rest-client` gem for this to work."
>
> The rest-client gem is then installed before the code that uses this type
> is run, but the actual provider still thinks the rest-client is not present
> (as it was loaded without it), thus it fails to run.
>
> Is there any way to force puppet to reload the provider before the
> associated custom type is run, or anything else I can do?
>

In older versions of puppet use puppet feature to determine availability. I
think the cutover is somewhere in 3.x where you only need to require the
gem. Assuming require 'rest-client' is specified in the provider, two
possibility:

1. resource order. this can be fixed via autorequire in the custom type to
require either the class where rest-client gem is specified or the package
rest-client.
2. the rest-client gem is not installed in puppet's ruby library path. For
example puppet enterprise should be installed via /opt/puppet/bin/gem, and
on versions of Ubuntu/Debian you may have multiple versions of Ruby (puppet
might be installed for Ruby 1.8 while the default gem path is for Ruby 1.9).

Thanks,

Nan

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CACqVBqAWoHqgQavKjNJKuasYOPxMbB_OHEVjisaaFinq7DEBVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to