Closed Dorin-Pleava closed 4 years ago
Puppetfiles
.These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.
Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.
I could not reproduce the error when applying a manifest similar to the export and collecting in the https://github.com/ghoneycutt/puppet-module-ssh module.
#test.pp
@@sshkey { $::fqdn :
ensure => present,
host_aliases => [$::hostname, $::ipaddress, $::ipaddress6],
type => 'rsa',
key => '...key...',
}
Sshkey <<||>> {
target => '/etc/ssh/ssh_known_hosts',
}
Using module https://github.com/ghoneycutt/puppet-module-ssh to export and collect sshkey resources from nodes, an 'already declared' error appears.
This happened because when the catalog is first converted to resouces, the sshkey resource is added via https://github.com/puppetlabs/puppet/blob/main/lib/puppet/resource/catalog.rb#L137, where 'resource.ref'(https://github.com/puppetlabs/puppet/blob/main/lib/puppet/type.rb#L2548) uses 'self.title'. Since self.title goes to the title method defined in type.rb, it will return a different title than the title method from https://github.com/puppetlabs/puppetlabs-sshkeys_core/blob/main/lib/puppet/provider/sshkey/parsed.rb#L31. This mismatch try to add both resource, resulting in the 'already declared' error.