torrancew/puppet-account — pull request #38 by lloy0076 (2014-10-06 21:32:36+00:00)
Title: Feature/multiple ssh keys

Let me propose two new parameters:

* rsa_keys
* dsa_keys

This allows one to do stuff like:

test_user:
rsa_keys:
- 'authorized_key_here_1'
- 'authorized_key_here_2'

And similarly for dsa_keys.

Principally I suggest this to avoid overly complicated YAML.

Because I wasn't convinced that authorised keys couldn't contain characters not allowed in class/resource names I based a "str2md5" on puppetlabs/stdlib's "str2saltedsha512". Theoretically that probably is useful enough to belong to "stdlib" itself.

Every key resource/class is named: "username-md5_of_the_key" which should ensure unique names. It's somewhat wrong and/or redundant to give two ssh-authorized-key resources with exactly the same key anyway (so if someone does enter the same key more than once on the same user, they should expect things to fail imho).

I haven't written any tests up because, to be honest, I haven't a clue how to actually specify them. That said, it seems to work for me.