Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-6653

Ruby types still loaded even when a PCore type is found

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • PUP 4.6.1
    • PUP 4.6.2
    • None
    • None
    • 2
    • Language 2016-09-07
    • Bug Fix
    • Hide
      There were problems with the experimental feature that allows resource types to be loaded from meta data generated by {{puppet generate type}} instead of being loaded as ruby resource type implementations. The problems caused ruby implementations to be loaded even if there was a generated alternative available. This in turn could lead to different versions of the same type not being isolated to their respective environment.
      Show
      There were problems with the experimental feature that allows resource types to be loaded from meta data generated by {{puppet generate type}} instead of being loaded as ruby resource type implementations. The problems caused ruby implementations to be loaded even if there was a generated alternative available. This in turn could lead to different versions of the same type not being isolated to their respective environment.

    Description

      In PE, we recently merged a change that ran `puppet generate types` on all changed environments. This resulted in catalog compile failures on the server side. They looked like the following.

      It looks as though the PCore file is being loaded first, and then maybe the ruby type is being loaded still? Line 116 in profile/master.pp is the a use of pe_ini_setting, but not a definition of it.

      2016-08-25 10:50:34,271 ERROR [qtp1820595966-74] [puppetserver] Puppet Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Resource Statement, Attempt to redefine entity 'http://puppet.com/2016.1/runtime/resource_type_pp/pe_ini_setting'. Originally set /etc/puppetlabs/code/environments/production/.resource_types/pe_ini_setting.pp. at /opt/puppetlabs/puppet/modules/puppet_enterprise/manifests/profile/master.pp:116:3 on node wiagamb4u9sm77e.delivery.puppetlabs.net
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/base_loader.rb:113:in `fail_redefine'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/base_loader.rb:63:in `set_entry'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/module_loaders.rb:152:in `find'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/runtime3_type_loader.rb:66:in `find_impl'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/runtime3_type_loader.rb:55:in `find'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/base_loader.rb:142:in `internal_load'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/base_loader.rb:32:in `load_typed'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/base_loader.rb:141:in `internal_load'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/base_loader.rb:32:in `load_typed'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/base_loader.rb:141:in `internal_load'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/base_loader.rb:32:in `load_typed'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/loader.rb:49:in `load'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/runtime3_resource_support.rb:104:in `find_builtin_resource_type'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/runtime3_resource_support.rb:71:in `find_resource_type'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/runtime3_resource_support.rb:23:in `create_resources'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/runtime3_support.rb:310:in `create_resources'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:818:in `eval_ResourceExpression'
      org/jruby/RubyArray.java:2412:in `map'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:815:in `eval_ResourceExpression'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:69:in `visit_this_1'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:82:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:622:in `eval_BlockExpression'
      org/jruby/RubyArray.java:1613:in `each'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:622:in `eval_BlockExpression'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:69:in `visit_this_1'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:82:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/parser/evaluating_parser.rb:63:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/ast/pops_bridge.rb:32:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/ast.rb:31:in `safeevaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/type.rb:182:in `evaluate_code'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/resource.rb:81:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/resource.rb:73:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:587:in `evaluate_definitions'
      org/jruby/RubyArray.java:1613:in `each'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:585:in `evaluate_definitions'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:584:in `evaluate_definitions'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/errors.rb:64:in `exceptwrap'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:583:in `evaluate_definitions'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:611:in `evaluate_generators'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:608:in `evaluate_generators'
      org/jruby/RubyKernel.java:1511:in `loop'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:605:in `evaluate_generators'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:187:in `compile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:187:in `compile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:65:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:241:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:162:in `compile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:33:in `compile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:266:in `compile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:264:in `compile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:223:in `benchmark'
      /opt/puppetlabs/server/apps/puppetserver/puppet-server-release.jar!/META-INF/jruby.home/lib/ruby/1.9/benchmark.rb:295:in `realtime'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:222:in `benchmark'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:262:in `compile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:53:in `find'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:194:in `find'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/indirected_routes.rb:121:in `do_find'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/indirected_routes.rb:48:in `call'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:65:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:241:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/indirected_routes.rb:47:in `call'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:82:in `process'
      org/jruby/RubyArray.java:1613:in `each'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:81:in `process'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:87:in `process'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:87:in `process'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/handler.rb:60:in `process'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/handler.rb:58:in `process'
      file:/opt/puppetlabs/server/apps/puppetserver/puppet-server-release.jar!/puppetserver-lib/puppet/server/master.rb:42:in `handleRequest'
      Puppet$$Server$$Master_996578613.gen:13:in `handleRequest'
      request_handler_core.clj:273:in `invoke'
      jruby_request.clj:46:in `invoke'
      jruby_request.clj:31:in `invoke'
      request_handler_service.clj:34:in `handle_request'
      request_handler.clj:3:in `invoke'
      request_handler.clj:3:in `invoke'
      core.clj:2493:in `invoke'
      ring_middleware.clj:284:in `invoke'
      core.clj:168:in `invoke'
      core.clj:211:in `invoke'
      core.clj:45:in `invoke'
      core.clj:330:in `invoke'
      core.clj:51:in `invoke'
      ringutils.clj:86:in `invoke'
      master_core.clj:428:in `invoke'
      ring.clj:21:in `invoke'
      ring.clj:12:in `invoke'
      comidi.clj:249:in `invoke'
      http.clj:152:in `invoke'
      http.clj:152:in `invoke'
      http.clj:148:in `invoke'
      comidi.clj:336:in `invoke'
      jetty9_core.clj:424:in `invoke'
      normalized_uri_helpers.clj:80:in `invoke'
      

      Here is the PCore file:

      cat /etc/puppetlabs/code/environments/production/.resource_types/pe_ini_setting.pp
      # This file was automatically generated on 2016-08-25 10:40:26 -0700.
      # Use the 'puppet generate types' command to regenerate this file.
       
      Puppet::Resource::ResourceType3.new(
        'pe_ini_setting',
        [
          # The basic property that the resource should be in.
          #
          # Valid values are `present`, `absent`.
          Puppet::Resource::Param(Enum['present', 'absent'], 'ensure'),
       
          # The value of the setting to be defined.
          Puppet::Resource::Param(Any, 'value')
        ],
        [
          # An arbitrary name used as the identity of the resource.
          Puppet::Resource::Param(Any, 'name', true),
       
          # The name of the section in the ini file in which the setting should be defined.
          Puppet::Resource::Param(Any, 'section'),
       
          # The name of the setting to be defined.
          Puppet::Resource::Param(Any, 'setting'),
       
          # The ini file Puppet will ensure contains the specified setting.
          Puppet::Resource::Param(Any, 'path'),
       
          # The separator string to use between each setting name and value. Defaults to " = ", but you could use this to override e.g. whether or not the separator should include whitespace.
          Puppet::Resource::Param(Any, 'key_val_separator'),
       
          # The specific backend to use for this `pe_ini_setting`
          # resource. You will seldom need to specify this --- Puppet will usually
          # discover the appropriate provider for your platform.Available providers are:
          #
          # ruby
          # :
          Puppet::Resource::Param(Any, 'provider')
        ],
        {
          /(.*)/ => ['name']
        },
        true)
      

      Attachments

        Issue Links

          Activity

            People

              qa qa
              matthaus Past Haus
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support