Bug #13633
`puppet resource ssh_authorized_key <user>` should work
| Status: | Accepted | Start date: | 04/04/2012 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% | |
| Category: | - | |||
| Target version: | - | |||
| Affected Puppet version: | Branch: | |||
| Keywords: | ||||
Description
One of my clients remarked that he was working through the Learning Puppet track and ran into a stack trace.
Learning Puppet teaches the puppet resource command, the later has an exercise for the ssh_authorized_key resource (on http://docs.puppetlabs.com/learning/manifests.html). Running puppet resource ssh_authorized_key hunner throws a stack trace because lib/puppet/type/ssh_authorized_key:104, @parameters[:target] is nil.
cz% envpuppet puppet resource ssh_authorized_key hunner
/Users/hunner/Documents/work/git/puppet/lib/puppet/type/ssh_authorized_key.rb:104:in `validate': undefined method `[]' for nil:NilClass (NoMethodError)
from /Users/hunner/Documents/work/git/puppet/lib/puppet/type.rb:1807:in `initialize'
from /Users/hunner/Documents/work/git/puppet/lib/puppet/indirector/resource/ral.rb:5:in `new'
from /Users/hunner/Documents/work/git/puppet/lib/puppet/indirector/resource/ral.rb:5:in `find'
from /Users/hunner/Documents/work/git/puppet/lib/puppet/indirector/indirection.rb:196:in `find'
from /Users/hunner/Documents/work/git/puppet/lib/puppet/application/resource.rb:222:in `find_or_save_resources'
from /Users/hunner/Documents/work/git/puppet/lib/puppet/application/resource.rb:144:in `main'
from /Users/hunner/Documents/work/git/puppet/lib/puppet/application.rb:317:in `run_command'
from /Users/hunner/Documents/work/git/puppet/lib/puppet/application.rb:309:in `run'
from /Users/hunner/Documents/work/git/puppet/lib/puppet/application.rb:416:in `hook'
from /Users/hunner/Documents/work/git/puppet/lib/puppet/application.rb:309:in `run'
from /Users/hunner/Documents/work/git/puppet/lib/puppet/application.rb:407:in `exit_on_fail'
from /Users/hunner/Documents/work/git/puppet/lib/puppet/application.rb:309:in `run'
from /Users/hunner/Documents/work/git/puppet/lib/puppet/util/command_line.rb:69:in `execute'
from /Users/hunner/Documents/work/git/puppet/bin/puppet:4
cz% envpuppet puppet resource ssh_authorized_key hunner target=ssh-rsa
notice: /Ssh_authorized_key[hunner]/ensure: created
err: /Ssh_authorized_key[hunner]: Could not evaluate: Cannot write SSH authorized keys without user
ssh_authorized_key { 'hunner':
ensure => 'present',
target => 'ssh-rsa',
}
I have two ssh-rsa keys in ~/.ssh/authorized_keys2
History
#1
Updated by Jeff Weiss about 1 year ago
- Status changed from Unreviewed to Accepted
It sounds like the expected functionality of ssh_authorized_key is that you can specify a user and the type will automatically locate (and read the keys and put them into the user/.ssh/authorized_keys file.
This is not the way ssh_authorized_key actually works today. There is obviously a mismatch between existing functionality, which require the key (contents of id_rsa) in the manifest, along with type, and user.
We really ought to make ssh_authorized_key more intuitive.