puppetlabs / puppetlabs/puppetlabs-sshkeys_core

sshkey uses name instead of title for duplication check

Open
#95 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Ruby
Stars
3
Forks
34
PR merge metrics
No merged PRs in 30d

Description

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

  • Version puppetserver-2.7.2-1.el6.noarch (2.7.2)/puppet-agent-1.9.3-1.el6.x86_64 (4.9.4)
  • Platform CentOS 6.8/6.9

Additional Context

This was originally filed as MODULES-7610.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the duplicate-definition error with the two sshkey resources described in the issue, using different titles and targets. Trace the sshkey resource's duplication or alias handling and verify that distinct titles are accepted while identical definitions remain protected. Done means changing the title no longer causes a duplicate resource error for keys installed in different locations.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.