Search code examples
rubypuppet

Custom Puppet Type breaks puppet describe with "no such file to load -- json" (2.7)


I wrote a few custom Puppet types. As long as they all were used on the same node,

puppet describe <my_custom_type>

worked fine, displaying the documentation from CLI.

Then I wrote another custom type, but now I get

# puppet describe <my_new_custom_type>
Could not run: Could not autoload /var/lib/puppet/lib/puppet/type/<my_older_custom_type>: Could not autoload /var/lib/puppet/lib/puppet/provider/<my_older_custom_type>/<custom_provider>.rb: no such file to load -- json

A glimpse under the /var/lib/puppet/lib/puppet reveals that the 'missing' files are there. When I delete the old custom types' files under /var/lib/puppet/lib/puppet, then # puppet describe <my_new_custom_type> works fine.

Can someone advise an inexpensive workaround? Or I'm I overlooking something? I have to use Puppet v 2.7.something at the moment (not my personal choice), which will be upgraded in a matter of months, so if this is fixed in newer versions, I'd leave it as it is.

All aforementioned custom types/providers are working, of course. The isuue is limited to puppet describe functionality.


Solution

  • Unfortunately, Ruby gems that are required by one of your custom types must be provided for all your Puppet agents.

    The agent invariably syncs the types and providers to your agents, because at the time of plugin sync, the agent cannot yet tell whether a type is required by the catalog or not.

    If you can delegate the functionality to an external tool instead, Puppet will be able to discern that the provider just isn't suitable for most agents.