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

Classifier synchronization can pull unused code into catalog compilation

    XMLWordPrintable

Details

    • Major

    Description

      Classifier Synchronization (when the classifier requests class information from Puppet Server via the 'resource_types' endpoint) causes all manifests within an environment to be parsed. If this parsing intersects with a catalog request, the resulting compilation will be exposed to any latent problems that exist in the environment: bugs in unused manifests, misplaced or temporary testing code, etc.

      Reproduction Case

      Install a PE 3.7.1 all-in-one master.

      Create a test module which contains a half-implemented class:

      mkdir -p /etc/puppetlabs/puppet/environments/production/modules/compile_test/manifests
       
      cat << EOF > /etc/puppetlabs/puppet/environments/production/modules/compile_test/manifests/init.pp
      # A work in progress.
      class compile_test {
        fail("This class isn't implemented yet!")
      }
       
      # Leftover testing code.
      include compile_test
      EOF
      

      Run the Puppet Agent a few times to verify that the class is not usually included in catalogs:

      # service pe-puppet stop
       
      # while true;do puppet agent -t;done
       
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Info: Caching catalog for pe-371-master.puppetdebug.vlan
      Info: Applying configuration version '1421168813'
      Notice: Finished catalog run in 8.67 seconds
       
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Info: Caching catalog for pe-371-master.puppetdebug.vlan
      Info: Applying configuration version '1421168848'
      Notice: Finished catalog run in 7.57 seconds
       
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Info: Caching catalog for pe-371-master.puppetdebug.vlan
      Info: Applying configuration version '1421168882'
      Notice: Finished catalog run in 7.10 seconds
       
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Info: Caching catalog for pe-371-master.puppetdebug.vlan
      Info: Applying configuration version '1421168813'
      Notice: Finished catalog run in 7.30 seconds
       
      ...
      

      Edit /etc/puppetlabs/console-services/conf.d/classifier.conf and set the synchronization-period to 5 seconds in order to aggrivate the bug. Restart pe-console-services.

      Outcome

      With the sync period turned up, compilation fails on nearly every run due to sync activities loading classes that otherwise would not be loaded into the compiler:

      # while true;do puppet agent -t;done
       
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Error: Could not retrieve catalog from remote server: Error 400 on SERVER: This class isn't implemented yet! at /etc/puppetlabs/puppet/environments/production/modules/compile_test/manifests/init.pp:3 on node pe-371-master.puppetdebug.vlan
      Warning: Not using cache on failed catalog
      Error: Could not retrieve catalog; skipping run
       
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Error: Could not retrieve catalog from remote server: Error 400 on SERVER: This class isn't implemented yet! at /etc/puppetlabs/puppet/environments/production/modules/compile_test/manifests/init.pp:3 on node pe-371-master.puppetdebug.vlan
      Warning: Not using cache on failed catalog
      Error: Could not retrieve catalog; skipping run
       
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Error: Could not retrieve catalog from remote server: Error 400 on SERVER: This class isn't implemented yet! at /etc/puppetlabs/puppet/environments/production/modules/compile_test/manifests/init.pp:3 on node pe-371-master.puppetdebug.vlan
      Warning: Not using cache on failed catalog
      Error: Could not retrieve catalog; skipping run
       
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Error: Could not retrieve catalog from remote server: Error 400 on SERVER: This class isn't implemented yet! at /etc/puppetlabs/puppet/environments/production/modules/compile_test/manifests/init.pp:3 on node pe-371-master.puppetdebug.vlan
      Warning: Not using cache on failed catalog
      Error: Could not retrieve catalog; skipping run
       
      ...
      

      Expected Outcome

      Classifier synchronization has no effect on which manifests are loaded for catalog compilation.

      Attachments

        Issue Links

          Activity

            People

              qa qa
              l.smith Lindsey Smith
              Kurt Wall Kurt Wall
              Votes:
              0 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support