puppet-archive
puppet-archive copied to clipboard
archive defined resource type not autloading without dependency specification
Affected Puppet, Ruby, OS and module versions/distributions
- Puppet: 5.5.1/2018.1.0
- Ruby: 2.4.3
- Distribution: RHEL7 Master/Windows 2016 Client
- Module version: 3.1.0
How to reproduce (e.g Puppet code you use)
archive { 'title':
parameter => value
}
What are you seeing
Puppet attempts to autoload archive as a custom type/provider instead of a defined resource type unless the module is specified as a dependency in the metadata.json.
What behaviour did you expect instead
Puppet autoloads archive as a defined resource type.
Output log
Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not autoload puppet/type/archive: Could not autoload puppet/provider/archive/ruby: Unable to find archive module in modulepath /etc/puppetlabs/code/modules:/opt/puppetlabs/puppet/modules on node client
Any additional information you'd like to impart
We are seeing this occur for only the archive defined resource type. Others are autoloading without specifying the associated module as a dependency. This might be an issue external to the archive module, but we are seeing it only for the archive defined resource type, so I am trying here first.
Hi,
why do you expect Puppet to load archive as a defined resource? This module provides proper types and providers, but no defined resources named archive.
Ok, my bad, I inferred from the documentation that it was a defined resource type and a class. I can edit the issue for Puppet failing to autoload it as a custom type and provider then if there is a desire to remedy that issue.
Reviving this issue, since I happen to run into it myself even two years later.
2020-07-17 13:38:51 +0200 Puppet (err): Could not autoload puppet/provider/archive/ruby: Unable to find archive module in modulepath /etc/puppetlabs/code/environments/common:/etc/puppetlabs/code/modules:/opt/puppetlabs/puppet/modules:/usr/share/puppet/modules 2020-07-17 13:38:51 +0200 Puppet (err): Could not autoload puppet/type/archive: Could not autoload puppet/provider/archive/ruby: Unable to find archive module in modulepath /etc/puppetlabs/code/environments/common:/etc/puppetlabs/code/modules:/opt/puppetlabs/puppet/modules:/usr/share/puppet/modules
The file is there and the module path includes that location.
[root@puppet5-master ~]# find /etc/puppetlabs/code/environments/puppet5/modules -name archive.rb
/etc/puppetlabs/code/environments/puppet5/modules/archive/lib/puppet_x/bodeco/archive.rb
/etc/puppetlabs/code/environments/puppet5/modules/archive/lib/puppet/type/archive.rb
[root@puppet5-master ~]# puppet config --environment puppet5 --section master print modulepath
/etc/puppetlabs/code/environments/puppet5/modules:/etc/puppetlabs/code/environments/puppet5/modules:/etc/puppetlabs/code/environments/common:/etc/puppetlabs/code/modules:/opt/puppetlabs/puppet/modules:/usr/share/puppet/modules
We're using Open Source Puppet 5.5.17, Ruby as shipped with puppet-server (2.4.9p362) and 4.5.0 of this module.
includeing archive as a class somewhere did not avoid this error...
2020-07-17 13:38:50 +0200 Puppet (debug): importing '/etc/puppetlabs/code/environments/puppet5/modules/archive/manifests/init.pp' in environment puppet5 2020-07-17 13:38:50 +0200 Puppet (debug): Automatically imported archive from archive into puppet5 2020-07-17 13:38:50 +0200 Puppet (debug): importing '/etc/puppetlabs/code/environments/puppet5/modules/archive/manifests/params.pp' in environment puppet5 2020-07-17 13:38:50 +0200 Puppet (debug): Automatically imported archive::params from archive/params into puppet5
... nor did adding it as a dependency to some metadata.json file.
The first error message is emitted from line 7 of lib/puppet/provider/archive/ruby.rb, I assume. Somehow, this invocation fails for our setup, which I was not aware of being flawed in any way. Moving the module sources into /etc/puppetlabs/code/modules avoids the error, but does break our setup conventions. It looks like only the basemodulepath is searched, not the specific modulepath of the environment.
Are you running puppet generate types?
See https://puppet.com/docs/puppet/6.17/environment_isolation.html#env_generate_types
This happens automatically for Puppet Enterprise users. Open source puppet users need to build it into their puppet environment deployment workflow. If you use R10k, it has options for automatically calling puppet generate types, but this isn't the default.
Hi Alexander,
no, we don't use r10k, nor have we run puppet generate types. We're coming from Puppet 3 to Puppet 5 and this is completely new to me. Thank you for the hint!
After puppet generate types the error has gone away. Can you tell me whether it will be necessary to rerun this command whenever a custom resource type of the environment has changed? Or only when new types are added or old ones removed?
Best regards,
Xavier.