opscode-cookbooks/users — pull request #41 by iroller (2014-03-05 14:41:26+00:00)
Title: [COOK-4403] Allow building authorized_keys file using existing public keys

From updated README:

Instead of listing all required public keys in ```ssh_keys``` you can list users or even groups where public keys should be taken from. This can be done by adding ```extra_ssh_keys``` attribute:

```javascript
{
"id": "bofh",
"ssh_keys": [
"ssh-rsa AAA123...xyz== foo",
"ssh-rsa AAA456...uvw== bar"
],
"extra_ssh_keys": {
"from_users": ["foo", "bar"],
"from_groups": ["sysadmin"]
}
}
```

* Note it will search for ```ssh_public_key``` attributes in every user listed in ```from_users``` array and every user found in ```from_groups``` array. All founded keys will be merged with the keys from ```ssh_keys``` attribute. This it particular useful when you're creating a shared user and want to allow other users to use it for establishing ssh connection.

Also added tests for ssh_keys and ssh_extra_keys.
```
% bundle exec rspec spec/unit/recipes/test_ssh_keys_spec.rb
.......

Finished in 2.72 seconds
7 examples, 0 failures

WARNING: ChefSpec Coverage reporting is in beta. Please use with caution.

ChefSpec Coverage report generated at '.coverage/results.json':

Total Resources: 17
Touched Resources: 17
Touch Coverage: 100.0%
```

Please note that it should be merged only after my previous pull request since it uses testing environment configured by it:
https://github.com/opscode-cookbooks/users/pull/40