puppetlabs / puppetlabs-sshkeys_core

Apache License 2.0
4 stars 32 forks source link

sshkey uses name instead of title for duplication check #95

Open anarcat opened 1 week ago

anarcat commented 1 week ago

Describe the Bug

With 2 resources named pxe-example.com and dhcp-example.com I get duplicate definition error. The target and title are different in both. The rest is the same.

sshkey { 'pxe-example.com':
    ensure => 'present',
    name   => 'example.com',
    type   => 'ssh-rsa',
    key    => '<redacted>',
    target => '/var/lib/<user>/.ssh/known_hosts',
}

In an environment where sshd is intentionally configured to not read a global known hosts file, attempting to change the resource title for the same key installed into different locations fails.

Cannot alias Sshkey[pxe-example.com] to ["example.com"] at /etc/puppetlabs/code/environments/dhcp/site/role/manifests/pxe.pp:56; resource ["Sshkey", "example.com"] already declared at /etc/puppetlabs/code/environments/dhcp/site/role/manifests/dhcp.pp:73 at /etc/puppetlabs/code/environments/dhcp/site/role/manifests/pxe.pp:56:3 on node dhcp-failover.err.internal

Expected Behavior

Expected behavior is that changing the title suffices in it being a different resource.

Steps to Reproduce

See above.

Environment

Additional Context

This was originally filed as MODULES-7610.