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

Add catalog edge only if parent resource has a container

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 6.23.0, PUP 7.8.0
    • Component/s: None
    • Labels:
    • Template:
      PUP Bug Template
    • Team:
      Night's Watch
    • Story Points:
      3
    • Sprint:
      NW - 2021-06-16
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      Due to the presence of a nil vertex in the catalog, managing resources that call the `generate` method (such as `tidy`) would fail when using the `puppet resource` subcommand. This has been fixed by ensuring that nil vertices are never added to the catalog.
      Show
      Due to the presence of a nil vertex in the catalog, managing resources that call the `generate` method (such as `tidy`) would fail when using the `puppet resource` subcommand. This has been fixed by ensuring that nil vertices are never added to the catalog.
    • QA Risk Assessment:
      Needs Assessment

      Description

      Puppet Version: 7.7.0/6.23.0
      Puppet Server Version: n/a
      OS Name/Version: n/a

      Managing resources with generators behaves differently with puppet resource and puppet apply.

      When running with puppet apply, the parent resource is always contained by something like Class[Main], so adding an edge between that and our generated resource works.

      When running with puppet resource, the parent resource is not contained by anything (container_of(parent_resource) returns nil), which adds an edge with a nil vertex to the catalog. This in turn causes the run to fail with a NilClass exception when performing pre-run checks in the Transaction class, as the catalog now contains a nil vertex.

      Desired Behavior:

      Running the following does not error:

      > touch /tmp/asd
      > puppet resource tidy /tmp/asd age=0 --trace
      

      Actual Behavior:

      Running the above example gives the following error:

      Error: Could not run: undefined method `pre_run_check' for nil:NilClass
      /root/puppet/lib/puppet/transaction.rb:82:in `block in perform_pre_run_checks'
      /root/puppet/lib/puppet/transaction.rb:78:in `each'
      /root/puppet/lib/puppet/transaction.rb:78:in `perform_pre_run_checks'
      /root/puppet/lib/puppet/transaction.rb:104:in `evaluate'
      /root/puppet/lib/puppet/resource/catalog.rb:240:in `block (2 levels) in apply'
      [snip]
      

        Attachments

          Activity

            People

            Assignee:
            gabriel.nagy Gabriel Nagy
            Reporter:
            gabriel.nagy Gabriel Nagy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support