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

Environment used before set in Resource.initialize when this needs access to its type

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: PUP 3.7.4
    • Fix Version/s: PUP 3.7.5
    • Component/s: None
    • Labels:
      None
    • Template:
    • Story Points:
      2
    • Sprint:
      Language 2015-02-04, Language 2015-02-18

      Description

      UPDATED


      This was a bug, an internal problem that occurred because the actual code path that triggered the problem had never been considered prior to the changes that made this problem surface.

      ORIGINAL


      I'm not able to do a clean run of the puppet specs when using stable or the tagged 3.7.4 commit. If I revert back to the commit just before this one: 0be9c1a (fix for PUP-3755), then everything works OK.

      There's nothing wrong with the commit but it provokes the real problem which is that the Resource initializer method calls on resource_type which in turn needs the current_environment at a point where the environment has not been set. Thus, it falls back to the *root* environment rather than using the environment from the catalog that created it and the resource type is not found.

      I have no good explanation to why this test passed everywhere before 3.7.4 was released. I'm not able to get a green 3.7.4 or stable build on any of my machines.

      The spec that fails is this one:

        1) Pure ruby manifests should allow defines
           Failure/Error: catalog.resource("Bar[instance]").should_not be_nil
           Puppet::Error:
             Could not parse for environment *root*: No file(s) found for import of 'foo' at line 2
           # ./lib/puppet/parser/parser_support.rb:175:in `rescue in parse'
           # ./lib/puppet/parser/parser_support.rb:166:in `parse'
           # ./lib/puppet/node/environment.rb:545:in `perform_initial_import'
           # ./lib/puppet/node/environment.rb:276:in `known_resource_types'
           # ./lib/puppet/resource.rb:276:in `resource_type'
           # ./lib/puppet/resource.rb:242:in `initialize'
           # ./lib/puppet/resource/catalog.rb:305:in `new'
           # ./lib/puppet/resource/catalog.rb:305:in `resource'
           # ./spec/integration/parser/ruby_manifest_spec.rb:39:in `block (2 levels) in <top (required)>'
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                thomas.hallgren Thomas Hallgren
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support