Details
-
Task
-
Status: Accepted
-
Low
-
Resolution: Unresolved
-
None
-
None
Description
Situation: You have two resource types of the same name provided by two different modules. You revert your code to remove the newest of the modules, which supplies the newest of the two types.
Expectation: puppet generate types updates to the older of the two types.
Behavior: puppet generate types uses the version with the newest timestamp, potentially causing hard to diagnose catalog errors when your repository's code is correct. The only solution ends up manually removing the newer file through /etc/puppetlabs/code-staging/*/production/.resource_types/ and re-running a code deploy/type regen.
# puppet agent -t
|
Info: Using configured environment 'production'
|
Info: Retrieving pluginfacts
|
Info: Retrieving plugin
|
...
|
Info: Retrieving locales
|
Info: Loading facts
|
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: no parameter named '<name>' (file: /etc/puppetlabs/code/environments/production/modules/<module>/manifests/<class>.pp, line: 18) on Class[<title>] (file: /etc/puppetlabs/code/environments/production/modules/<module>/manifests/<class>.pp, line: 18) on node...
|
The relevant code that determines whether the type needs to be regenerated can be found here:
https://github.com/puppetlabs/puppet/blob/7.0.0/lib/puppet/generate/type.rb#L49
Proposed Solutions:
1) Replace the timestamp logic and instead pass along `git diff` information
2) Add the --force flag to the generate types script to skip the timestamp check:
https://github.com/puppetlabs/pe-puppet-server-extensions/blob/2019.8.x/resources/ext/bin/generate-puppet-types.rb#L12-L16
Such as from the following behavior:
https://github.com/puppetlabs/puppet/blob/main/lib/puppet/face/generate.rb#L40-L43