Uploaded image for project: 'Puppet Server'
  1. Puppet Server
  2. SERVER-2923

Regenerated puppet types with duplicate names fails to revert changes

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Accepted
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Puppet Server
    • Labels:
    • Template:
    • Team:
      Froyo
    • Zendesk Ticket IDs:
      42102,44362
    • Zendesk Ticket Count:
      2
    • QA Risk Assessment:
      Needs Assessment

      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

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            miranda.streeter Miranda Streeter
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:

                Zendesk Support