Ask Your Question

Provider autoload and gems

asked 2016-05-27 06:55:41 -0600

rvalle gravatar image


We currently run puppet 3.7 or 3.8 depending on the server.

About a couple of years ago we implemented a provider for managing KVM Virtual Machines.

The provider has been implemented using the gem ruby-libvirt.

Lately some of our puppets are refusing to run with the error:

Error: Could not autoload puppet/provider/libvirtnetwork/libvirt: cannot load such file -- libvirt

due to the:

require 'libvirt'

The module itself ensures that the GEM is installed before the resources are managed. which normally works fine.

This error is been triggered by some of the puppets that do not instantiate this resource. Others are totally fine.

It is unclear to me what makes some of the puppets fail, i.e. I have puppets v 3.7 where it works and others in 3.7 where it fails.

The libvirt gem is only installed if they use this module. So, all puppets currently working do not have the gem installed.

I have reviewed Puppet documentation for Provider development and it does not mention about the usage of GEMS I have looked many provider examples, and most seem to call OS commands.

Any idea what could be going on?

Also, is there any guide / best practice for implementing providers that depend on Ruby bindings?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-05-27 08:15:16 -0600

rvalle gravatar image

I just realized that in fact, one role is trying to delete the "default libvirt network", which in fact requires the resource, and the gem is not installed.

So the error, is totally legit.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-05-27 06:55:41 -0600

Seen: 159 times

Last updated: May 27 '16