Issue #13633 has been updated by Jeff Weiss.

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.
----------------------------------------
Bug #13633: `puppet resource ssh_authorized_key <user>` should work
https://projects.puppetlabs.com/issues/13633#change-60153

Author: Hunter Haugen
Status: Accepted
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


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`.

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

I have two ssh-rsa keys in `~/.ssh/authorized_keys2`


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to