Why can’t puppet find the defined resource

puppet

I have a defined resource in /etc/puppet/modules/autofs/manifests/mount.pp (from the pdx-cat/autofs module at https://forge.puppetlabs.com/pdxcat/autofs).

I have a module in /etc/puppet/modules/sheffield/manifests/autofs/net.pp which is trying to use the autofs::mount defined type.

class sheffield::autofs::net {
  include ::autofs

  autofs::mount { '/net':
    map     => '',
    options => '-hosts',
  }
}

But when the client attempts to grab the catalog, I get the following error;

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type autofs::mount at /etc/puppet/modules/sheffield/manifests/autofs/net.pp:7 on node rhel6test.shef.ac.uk

Any ideas? I thought maybe it was a problem with not being autoload the type as it has the same name (autofs) as a subclass in sheffield::autofs, so I tried renaming to sheffield::auto-fs and it made no difference.

I tried copying the mount.pp from /etc/puppet/autofs/manifests into /etc/puppet/sheffield/manifests/autofs/ and it did find the resource type, but didn't work because of a load of other missing dependencies in mount.pp (and obviously, that's not a nice solution to the problem).

Best Answer

Since include ::autofs gives no error, you should be able to use the same :: prefix on the define:

class sheffield::autofs::net {
  ::autofs::mount { '/net':
    ...
  }
}

If it doesn't work, there is probably an error in modulepath or other related settings.

include ::autofs line is actually not needed. The mount-define includes all necessary classes.

Related Topic