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

Add catalog edge only if parent resource has a container

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • PUP 6.23.0, PUP 7.8.0
    • None
    • Night's Watch
    • 3
    • NW - 2021-06-16
    • Needs Assessment
    • Bug Fix
    • 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.
    • 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

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

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support