Commit a459e3e
committed
Fix for resources that have a parameter named
According to
https://www.puppet.com/docs/puppet/7/lang_reserved.html#parameter-names
`type` is perfectly acceptable as the name of a class or defined type
parameter.
For example
https://github.com/voxpupuli/puppet-rsyslog/blob/3e6a94cd92e59c8d4a289b9e1fbb30e227bb48e6/manifests/component/template.pp#L5
Unfortunately, the existing code decided it was looking at a resource,
(and not a resource's changed parameters), by looking for a hash key of
`type`. This was tripping it up when formatting the report.
Specifically, the code would explode here
https://github.com/voxpupuli/puppet-catalog_diff/blob/a60fd2d526056feb31122b44823a35e8215f4305/lib/puppet/catalog-diff/formater.rb#L54
with
```
Error: undefined method `sort_by' for nil:NilClass`
```
as the method isn't being fed a resource and the `:parameters` key is
missing.
In this commit, we check the value of `header` to make sure we're not
calling `format.resource_reference` with something that isn't a
resource, and instead fall through to the correct `Format hash diffs`
code in the `else`.
(https://github.com/voxpupuli/puppet-catalog_diff/blob/a60fd2d526056feb31122b44823a35e8215f4305/lib/puppet/face/catalog/diff.rb#L298)type
1 parent a60fd2d commit a459e3e
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
| 286 | + | |
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| |||
0 commit comments