capistrano-chef 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +1 -1
- data/README.md +4 -0
- data/lib/capistrano/chef.rb +6 -1
- data/lib/capistrano/chef/version.rb +1 -1
- data/spec/capistrano/chef_spec.rb +24 -7
- metadata +11 -23
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6fda58b605a057ec49aa6e530aab00762acfda1b
|
4
|
+
data.tar.gz: df7ed8c88d4dde0e068750f634c6c54915ee20bb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 84b577561de62e2171dbbabded81ab66f2ece5d212b637d9a95ea8c82abdaf0ac05ffde6ba794ffe440155b142498d928ccb06359ab2d64370a79f28c9860211
|
7
|
+
data.tar.gz: e97ddf807fd2fb8eebc96fc856577a3e002f6f0f12b2eeebf30c49cf496196133924d360ed444bfd381281c82423fb1421d62797d54744eb3b49cc49d2718e13
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -42,6 +42,10 @@ This defines the same roles using Chef's [search feature](http://wiki.opscode.co
|
|
42
42
|
|
43
43
|
The `limit` attribute of the options hash will make it so only that the given number of items will be returned from a search.
|
44
44
|
|
45
|
+
You can also define multiple roles at the same time if the host list is identical. Instead of running multiple searches to the Chef server, you can pass an Array to `chef_role`:
|
46
|
+
|
47
|
+
chef_role [:web, :app], 'roles:web'
|
48
|
+
|
45
49
|
## Data Bags
|
46
50
|
|
47
51
|
Chef [Data Bags](http://wiki.opscode.com/display/chef/Data+Bags) let you store arbitrary JSON data. A common pattern is to use an _apps_ data bag to store data about an application for use in configuration and deployment.
|
data/lib/capistrano/chef.rb
CHANGED
@@ -52,7 +52,12 @@ module Capistrano::Chef
|
|
52
52
|
# Allows deployment from knifeless machine
|
53
53
|
# to specific hosts (ie. developent, staging)
|
54
54
|
unless ENV['HOSTS']
|
55
|
-
|
55
|
+
hosts = capistrano_chef.search_chef_nodes(query, options.delete(:attribute), options.delete(:limit)) + [options]
|
56
|
+
if name.is_a?(Array)
|
57
|
+
name.each { |n| role n, *hosts }
|
58
|
+
else
|
59
|
+
role name, *hosts
|
60
|
+
end
|
56
61
|
end
|
57
62
|
end
|
58
63
|
|
@@ -120,14 +120,31 @@ describe Capistrano::Chef do
|
|
120
120
|
end
|
121
121
|
|
122
122
|
describe '#chef_role' do
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
123
|
+
context 'when adding nodes to the role' do
|
124
|
+
before do
|
125
|
+
Capistrano::Chef.stub!(:search_chef_nodes).and_return(['10.0.0.2'])
|
126
|
+
@search = mock('Chef::Search::Query')
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'add nodes to one role' do
|
130
|
+
@configuration.should respond_to :chef_role
|
131
|
+
@configuration.chef_role(:test)
|
132
|
+
@configuration.roles.should have_key :test
|
133
|
+
@configuration.roles[:test].to_a[0].host.should === '10.0.0.2'
|
134
|
+
end
|
127
135
|
|
128
|
-
|
129
|
-
|
130
|
-
|
136
|
+
it 'supports defining multiple roles in one go to avoid multiple searches' do
|
137
|
+
@configuration.chef_role([:test, :test2])
|
138
|
+
@configuration.roles.should have_key :test
|
139
|
+
@configuration.roles.should have_key :test2
|
140
|
+
@configuration.roles[:test].to_a[0].host.should === '10.0.0.2'
|
141
|
+
@configuration.roles[:test2].to_a[0].host.should === '10.0.0.2'
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'does not call search more than once when defining multiple Cap roles' do
|
145
|
+
Capistrano::Chef.should_receive(:search_chef_nodes).once
|
146
|
+
@configuration.chef_role([:test, :test2])
|
147
|
+
end
|
131
148
|
end
|
132
149
|
|
133
150
|
it 'defaults to calling search with :ipaddress as the attribute and 1000 as the limit when giving a query' do
|
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.7
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Nathan L Smith
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-03-08 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: capistrano
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '2'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '2'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: chef
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 0.10.10
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 0.10.10
|
46
41
|
description: Allows capistrano to use Chef data for deployment
|
@@ -65,33 +60,26 @@ files:
|
|
65
60
|
homepage: https://github.com/cramerdev/capistrano-chef
|
66
61
|
licenses:
|
67
62
|
- MIT
|
63
|
+
metadata: {}
|
68
64
|
post_install_message:
|
69
65
|
rdoc_options: []
|
70
66
|
require_paths:
|
71
67
|
- lib
|
72
68
|
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
69
|
requirements:
|
75
|
-
- -
|
70
|
+
- - '>='
|
76
71
|
- !ruby/object:Gem::Version
|
77
72
|
version: '0'
|
78
|
-
segments:
|
79
|
-
- 0
|
80
|
-
hash: -1809424377071996865
|
81
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
74
|
requirements:
|
84
|
-
- -
|
75
|
+
- - '>='
|
85
76
|
- !ruby/object:Gem::Version
|
86
77
|
version: '0'
|
87
|
-
segments:
|
88
|
-
- 0
|
89
|
-
hash: -1809424377071996865
|
90
78
|
requirements: []
|
91
79
|
rubyforge_project: capistrano-chef
|
92
|
-
rubygems_version:
|
80
|
+
rubygems_version: 2.0.0
|
93
81
|
signing_key:
|
94
|
-
specification_version:
|
82
|
+
specification_version: 4
|
95
83
|
summary: Capistrano extensions for Chef integration
|
96
84
|
test_files:
|
97
85
|
- spec/capistrano/chef_spec.rb
|