Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
None
-
Night's Watch
-
3
-
NW - 2021-06-16
-
Needs Assessment
-
Bug Fix
-
-
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]
|