Search code examples
puppet

Puppet netdev_stdlib: How to fix "Invalid resource type netdev_device"?


I have set up Puppet master/agent in Oracle VirtualBox using Vagrant and installed netdev_stdlib on both master and agent according to instruction in the README.

I have set up module path to /etc/puppet/modules/netdev_stdlib where standard library stdlib also exists.

The master node is puppet.example.com and agent is node01.example.com.

My manifest file is as follows:

node default {
    file { "/tmp/example_ip": ensure  => present }

    include stdlib               #  No error on this line
    # include netdev_stdlib      #  Uncomment this line will cause error
    netdev_device { $hostname: }
}

However, when I run puppet agent -t on the client I got

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type netdev_device at /etc/puppet/manifests/site.pp:17 on node node01.example.com Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

I tried to use include netdev_stdlib in the manifest file site.pp, but Puppet couldn't find the class netdev_stdlib. However, include stdlib is fine.


Solution

  • I tried to use include netdev_stdlib in manifest file site.pp but Puppet couldn't find the class netdev_stdlib, but include stdlib is fine.

    The netdev_stdlib module doesn't provide a class that can simply be included. It's more of a programming framework for writing new Puppet types to manage network devices in Ruby.

    You should either use the module to write a new network device module of your own for interfacing to some new type of device, per the README, or remove it and don't include the class.

    If you're trying to manage a network device, you should look for an existing module that supports that type of device - it may then use this module as a dependency instead. If you're not managing a network device, I don't think you should be trying to use the module.

    Note that most module READMEs will indicate class names that can be included; not all modules will contain Puppet classes.