puppetlabs / puppetlabs-sshkeys_core

Apache License 2.0
4 stars 32 forks source link

(MODULES-10827) Exported sshkey already exists error #38

Closed Dorin-Pleava closed 4 years ago

Dorin-Pleava commented 4 years ago

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.

puppet-community-rangefinder[bot] commented 4 years ago

sshkey is a type

Breaking changes to this file MAY impact these 34 modules (near match): * [sharpie-deploy_keys](https://github.com/Sharpie/puppet-deploy_keys) * [lboynton-gitlab](https://github.com/lboynton/puppet-gitlab) * [kupson-ssh](https://github.com/kupson/puppet-ssh.git) * [aboe-openssh](https://github.com/aboe76/puppet-openssh.git) * [tampakrap-account](https://github.com/tampakrap/puppet-account) * [dhgwilliam-dynenv](https://forge.puppet.com/dhgwilliam/dynenv) * [ivaldi-rsnapshot](https://github.com/ivaldi/ivaldi-rsnapshot) * [thbe-ssh](https://github.com/thbe/puppet-ssh.git) * [example42-psick](https://github.com/example42/puppet-psick) * [puppet-system](https://github.com/voxpupuli/puppet-system.git) * [devopera-docommon](https://github.com/devopera/puppet-docommon) * [jakeb-system](https://forge.puppet.com/jakeb/system) * [inkblot-github](https://forge.puppet.com/inkblot/github) * [gabe-ansible](https://github.com/gabe-sky/puppet-ansible) * [fonk-openssh](https://github.com/fonk/fonk-openssh) * [mthibaut-mutual_trust](https://forge.puppet.com/mthibaut/mutual_trust) * [sbadia-gitlab](https://github.com/sbadia/puppet-gitlab.git) * [inkblot-bitbucket_org](https://forge.puppet.com/inkblot/bitbucket_org) * [zleslie-ssh](https://github.com/xaque208/puppet-ssh.git) * [maestrodev-maestro_nodes](http://github.com/maestrodev/puppet-maestro_nodes) * [wyrie-backuppc](https://bitbucket.org/wyrie/puppet-backuppc/src) * [it2ndq-barman](https://github.com/2ndquadrant-it/puppet-barman.git) * [deric-barman](https://github.com/deric/puppet-barman.git) * [systemsathomesdotcom-ssh](https://github.com/systemsathomesdotcom/puppet-openssh) * [aptituz-ssh](https://github.com/aptituz/puppet-openssh) * [oris-appserver](https://bitbucket.org/oris/env-puppet-module-appserver) * [nvogel-ansible](https://github.com/nvogel/puppet-ansible) * [puppet-amanda](https://github.com/voxpupuli/puppet-amanda.git) * [themeier-ssh](https://github.com/themeier/puppet-module-ssh.git) * [saz-ssh](https://github.com/saz/puppet-ssh.git) * [example42-openssh](https://github.com/example42/puppet-openssh) * [olevole-ssh](https://github.com/olevole/puppet-module-ssh.git) * [ghoneycutt-ssh](https://github.com/ghoneycutt/puppet-module-ssh.git) * [erwbgy-system](https://github.com/voxpupuli/puppet-system)

This module is declared in 5 of 575 indexed public 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.

Dorin-Pleava commented 4 years ago

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',
}