]> gitweb.fluxo.info Git - puppet-sshkeys_core.git/commit
(MODULES-10827) Exported sshkey already exists error
authorDorin Pleava <dorin.pleava@puppet.com>
Mon, 5 Oct 2020 09:02:33 +0000 (12:02 +0300)
committerDorin Pleava <dorin.pleava@puppet.com>
Mon, 5 Oct 2020 12:52:36 +0000 (15:52 +0300)
commit818e45b24d6fcdc49afe9e188ac761bf60373a31
tree4498d2d3ac06d0812fdb7b99ea027bb510120d1a
parent868382132a7e9408dbfd93d79d6436018b9da30d
(MODULES-10827) Exported sshkey already exists error

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.
lib/puppet/type/sshkey.rb
spec/unit/type/sshkey_spec.rb