Skip to content

Commit

Permalink
Rename cookbook
Browse files Browse the repository at this point in the history
  • Loading branch information
jubianchi committed Dec 18, 2014
1 parent d882a75 commit d3b58d4
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Berksfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
DEPENDENCIES
ssh-keys
user-ssh-keys
path: .
metadata: true

GRAPH
ssh-keys (0.1.0)
user-ssh-keys (1.0.0)
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ssh-keys-cookbook [![Build Status](https://travis-ci.org/pmsipilot/ssh-keys-cookbook.svg?branch=master)](https://travis-ci.org/pmsipilot/ssh-keys-cookbook)
# user-ssh-keys-cookbook [![Build Status](https://travis-ci.org/pmsipilot/user-ssh-keys-cookbook.svg?branch=master)](https://travis-ci.org/pmsipilot/user-ssh-keys-cookbook)

Deploys SSH keys and authorized keys

Expand All @@ -9,6 +9,8 @@ Deploys SSH keys and authorized keys

## Attributes

The root key of all attributes is `user_ssh_keys`.

| Key | Type | Default | Description |
| :---------- |:---------- | :--------- | :---------------------------------------------------- |
| `data_bag` | String | `ssh_keys` | Databag where to search for keys |
Expand All @@ -25,10 +27,10 @@ Deploys SSH keys and authorized keys

This cookbook provides one resource:

### `ssh_keys_key`
### `user_ssh_keys_key`

```ruby
ssh_keys_key 'john' do
user_ssh_keys_key 'john' do
authorized_keys [
'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDmz4D...',
'ssh-rsa sFE5JafGV4UmfxGP5/vpAAADWC8HcoQAyYT...'
Expand All @@ -55,19 +57,19 @@ A keypais is described as follow:

You can use this cookbook in tow ways:

* using the [default](#ssh-keys-default) recipe and providing (attributes)[#attributes]
* using the [default](#user-ssh-keys-default) recipe and providing (attributes)[#attributes]
* using the [LWRP](#lwrp)

Both methods require you to define a [databag](#databag) to define SSH key pairs. Defining attributes is not required if you only want to use the LWRP.

### ssh-keys::default
### user-ssh-keys::default

Include `ssh-keys` in your node's `run_list`:
Include `user-ssh-keys` in your node's `run_list`:

```json
{
"run_list": [
"recipe[ssh-keys]"
"recipe[user-ssh-keys]"
]
}
```
Expand Down
4 changes: 2 additions & 2 deletions attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
default['ssh_keys']['data_bag'] = 'ssh_keys'
default['ssh_keys']['users'] = []
default['user_ssh_keys']['data_bag'] = 'ssh_keys'
default['user_ssh_keys']['users'] = []
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name 'ssh-keys'
name 'user-ssh-keys'
maintainer 'PMSIpilot'
maintainer_email 'support@pmsipilot.com'
license 'MIT'
Expand Down
2 changes: 1 addition & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node['ssh_keys']['users'].each do |username, user|
ssh_keys_key username do
user_ssh_keys_key username do
authorized_keys user['authorized_keys']
authorized_users user['authorized_users']
data_bag node['ssh_keys']['data_bag']
Expand Down
22 changes: 11 additions & 11 deletions spec/unit/default_spec.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
require 'spec_helper'

describe 'ssh-keys::default' do
describe 'user-ssh-keys::default' do
describe 'Deploys SSH keys' do
describe 'With one user' do
it 'Throws a ConfigurationError if user does not exist' do
chef_run = ChefSpec::SoloRunner.new(step_into: ['ssh_keys_key']) do |node|
chef_run = ChefSpec::SoloRunner.new(step_into: ['user_ssh_keys_key']) do |node|
node.set['ssh_keys'] = {
:users => {
:bob => {}
Expand All @@ -23,7 +23,7 @@
:keys => []
})

chef_run = ChefSpec::SoloRunner.new(step_into: ['ssh_keys_key']) do |node|
chef_run = ChefSpec::SoloRunner.new(step_into: ['user_ssh_keys_key']) do |node|
node.set['ssh_keys'] = {
:users => {
:bob => {}
Expand All @@ -46,7 +46,7 @@
:keys => []
})

chef_run = ChefSpec::SoloRunner.new(step_into: ['ssh_keys_key']) do |node|
chef_run = ChefSpec::SoloRunner.new(step_into: ['user_ssh_keys_key']) do |node|
node.set['ssh_keys'] = {
:users => {
:bob => {}
Expand All @@ -72,7 +72,7 @@
]
})

chef_run = ChefSpec::SoloRunner.new(step_into: ['ssh_keys_key']) do |node|
chef_run = ChefSpec::SoloRunner.new(step_into: ['user_ssh_keys_key']) do |node|
node.set['ssh_keys'] = {
:users => {
:bob => {}
Expand Down Expand Up @@ -115,7 +115,7 @@
]
})

chef_run = ChefSpec::SoloRunner.new(step_into: ['ssh_keys_key']) do |node|
chef_run = ChefSpec::SoloRunner.new(step_into: ['user_ssh_keys_key']) do |node|
node.set['ssh_keys'] = {
:users => {
:bob => {}
Expand Down Expand Up @@ -154,7 +154,7 @@

describe 'With multiple users' do
it 'Throws a ConfigurationError if user does not exist' do
chef_run = ChefSpec::SoloRunner.new(step_into: ['ssh_keys_key']) do |node|
chef_run = ChefSpec::SoloRunner.new(step_into: ['user_ssh_keys_key']) do |node|
node.set['ssh_keys'] = {
:users => {
:bob => {
Expand Down Expand Up @@ -182,7 +182,7 @@
:keys => []
})

chef_run = ChefSpec::SoloRunner.new(step_into: ['ssh_keys_key']) do |node|
chef_run = ChefSpec::SoloRunner.new(step_into: ['user_ssh_keys_key']) do |node|
node.set['ssh_keys'] = {
:users => {
:bob => {
Expand All @@ -200,7 +200,7 @@
describe 'Add authorized users' do
describe 'With one user' do
it 'Throws a ConfigurationError if user does not exist in databag' do
chef_run = ChefSpec::SoloRunner.new(step_into: ['ssh_keys_key']) do |node|
chef_run = ChefSpec::SoloRunner.new(step_into: ['user_ssh_keys_key']) do |node|
node.set['ssh_keys'] = {
:users => {
:bob => {
Expand Down Expand Up @@ -239,7 +239,7 @@
]
})

chef_run = ChefSpec::SoloRunner.new(step_into: ['ssh_keys_key']) do |node|
chef_run = ChefSpec::SoloRunner.new(step_into: ['user_ssh_keys_key']) do |node|
node.set['ssh_keys'] = {
:users => {
:bob => {
Expand Down Expand Up @@ -283,7 +283,7 @@
]
})

chef_run = ChefSpec::SoloRunner.new(step_into: ['ssh_keys_key']) do |node|
chef_run = ChefSpec::SoloRunner.new(step_into: ['user_ssh_keys_key']) do |node|
node.set['ssh_keys'] = {
:users => {
:bob => {
Expand Down

0 comments on commit d3b58d4

Please sign in to comment.