cucumber-chef 2.1.0.rc.1 → 2.1.0.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/cc-knife +1 -1
- data/bin/cc-push +9 -14
- data/bin/cc-server +2 -3
- data/bin/cucumber-chef +111 -47
- data/chef_repo/cookbooks/cucumber-chef/recipes/test_lab.rb +2 -1
- data/cucumber-chef.gemspec +12 -4
- data/lib/cucumber/chef/bootstrap.rb +4 -3
- data/lib/cucumber/chef/config.rb +32 -17
- data/lib/cucumber/chef/helpers/chef_client.rb +6 -9
- data/lib/cucumber/chef/helpers/command.rb +1 -1
- data/lib/cucumber/chef/helpers/container.rb +5 -12
- data/lib/cucumber/chef/provider.rb +102 -0
- data/lib/cucumber/chef/providers/aws.rb +294 -0
- data/lib/cucumber/chef/providers/vagrant.rb +121 -0
- data/lib/cucumber/chef/provisioner.rb +32 -29
- data/lib/cucumber/chef/server.rb +133 -0
- data/lib/cucumber/chef/steps/ssh_steps.rb +23 -8
- data/lib/cucumber/chef/templates/bootstrap/ubuntu-precise-test-lab.erb +1 -1
- data/lib/cucumber/chef/templates/cucumber/cc-hooks.rb +8 -68
- data/lib/cucumber/chef/test_lab.rb +20 -309
- data/lib/cucumber/chef/utility.rb +109 -41
- data/lib/cucumber/chef/version.rb +1 -1
- data/lib/cucumber/chef.rb +5 -0
- metadata +42 -22
@@ -101,94 +101,160 @@ module Cucumber
|
|
101
101
|
################################################################################
|
102
102
|
|
103
103
|
def external_ip
|
104
|
-
%x(
|
104
|
+
%x(wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//').chomp.strip
|
105
|
+
end
|
106
|
+
|
107
|
+
################################################################################
|
108
|
+
# Path Helpers
|
109
|
+
################################################################################
|
110
|
+
|
111
|
+
def chef_repo
|
112
|
+
(Cucumber::Chef.locate_parent(".chef") rescue nil)
|
113
|
+
end
|
114
|
+
|
115
|
+
def in_chef_repo?
|
116
|
+
((chef_repo && File.exists?(chef_repo) && File.directory?(chef_repo)) ? true : false)
|
105
117
|
end
|
106
118
|
|
107
119
|
################################################################################
|
108
120
|
|
109
|
-
def
|
121
|
+
def root_dir
|
110
122
|
File.expand_path(File.join(File.dirname(__FILE__), "..", "..", ".."), File.dirname(__FILE__))
|
111
123
|
end
|
112
124
|
|
113
125
|
################################################################################
|
114
126
|
|
115
|
-
def
|
116
|
-
|
117
|
-
FileUtils.mkdir_p(
|
118
|
-
|
127
|
+
def home_dir
|
128
|
+
home_dir = File.join(Cucumber::Chef.locate_parent(".chef"), ".cucumber-chef")
|
129
|
+
FileUtils.mkdir_p(File.dirname(home_dir))
|
130
|
+
home_dir
|
119
131
|
end
|
120
132
|
|
121
133
|
################################################################################
|
122
134
|
|
123
|
-
def
|
124
|
-
|
125
|
-
FileUtils.mkdir_p(
|
126
|
-
|
135
|
+
def log_file
|
136
|
+
log_file = File.join(Cucumber::Chef.home_dir, "cucumber-chef.log")
|
137
|
+
FileUtils.mkdir_p(File.dirname(log_file))
|
138
|
+
log_file
|
127
139
|
end
|
128
140
|
|
129
141
|
################################################################################
|
130
142
|
|
131
143
|
def config_rb
|
132
|
-
|
133
|
-
FileUtils.mkdir_p(
|
134
|
-
|
144
|
+
config_rb = File.join(Cucumber::Chef.home_dir, "config.rb")
|
145
|
+
FileUtils.mkdir_p(File.dirname(config_rb))
|
146
|
+
config_rb
|
147
|
+
end
|
148
|
+
|
149
|
+
################################################################################
|
150
|
+
|
151
|
+
def knife_rb
|
152
|
+
knife_rb = File.join(Cucumber::Chef.home_dir, Cucumber::Chef::Config[:provider].to_s, "knife.rb")
|
153
|
+
FileUtils.mkdir_p(File.dirname(knife_rb))
|
154
|
+
knife_rb
|
135
155
|
end
|
136
156
|
|
137
157
|
################################################################################
|
138
158
|
|
139
159
|
def servers_bin
|
140
|
-
|
141
|
-
FileUtils.mkdir_p(
|
142
|
-
|
160
|
+
servers_bin = File.join(Cucumber::Chef.home_dir, Cucumber::Chef::Config[:provider].to_s, "servers.bin")
|
161
|
+
FileUtils.mkdir_p(File.dirname(servers_bin))
|
162
|
+
servers_bin
|
143
163
|
end
|
144
164
|
|
165
|
+
################################################################################
|
166
|
+
# Bootstraping SSH Helpers
|
145
167
|
################################################################################
|
146
168
|
|
147
|
-
def
|
148
|
-
|
169
|
+
def bootstrap_user
|
170
|
+
Cucumber::Chef::Config[Cucumber::Chef::Config[:provider]][:lab_user]
|
149
171
|
end
|
150
172
|
|
173
|
+
def bootstrap_identity
|
174
|
+
bootstrap_identity = Cucumber::Chef::Config[Cucumber::Chef::Config[:provider]][:identity_file]
|
175
|
+
File.exists?(bootstrap_identity) && File.chmod(0400, bootstrap_identity)
|
176
|
+
bootstrap_identity
|
177
|
+
end
|
178
|
+
|
179
|
+
################################################################################
|
180
|
+
# Test Lab SSH Helpers
|
151
181
|
################################################################################
|
152
182
|
|
153
|
-
def
|
154
|
-
|
183
|
+
def lab_user
|
184
|
+
Cucumber::Chef::Config[Cucumber::Chef::Config[:provider]][:lab_user]
|
185
|
+
end
|
186
|
+
|
187
|
+
def lab_user_home_dir
|
188
|
+
user = Cucumber::Chef::Config[Cucumber::Chef::Config[:provider]][:lab_user]
|
189
|
+
((user == "root") ? "/root" : "/home/#{user}")
|
190
|
+
end
|
191
|
+
|
192
|
+
def lab_identity
|
193
|
+
lab_identity = File.join(Cucumber::Chef.home_dir, Cucumber::Chef::Config[:provider].to_s, "id_rsa-#{lab_user}")
|
194
|
+
File.exists?(lab_identity) && File.chmod(0400, lab_identity)
|
195
|
+
lab_identity
|
196
|
+
end
|
197
|
+
|
198
|
+
################################################################################
|
199
|
+
# Container SSH Helpers
|
200
|
+
################################################################################
|
201
|
+
|
202
|
+
def lxc_user
|
203
|
+
Cucumber::Chef::Config[Cucumber::Chef::Config[:provider]][:lxc_user]
|
155
204
|
end
|
156
205
|
|
206
|
+
def lxc_user_home_dir
|
207
|
+
user = Cucumber::Chef::Config[Cucumber::Chef::Config[:provider]][:lxc_user]
|
208
|
+
((user == "root") ? "/root" : "/home/#{user}")
|
209
|
+
end
|
210
|
+
|
211
|
+
def lxc_identity
|
212
|
+
lxc_identity = File.join(Cucumber::Chef.home_dir, Cucumber::Chef::Config[:provider].to_s, "id_rsa-#{lab_user}")
|
213
|
+
File.exists?(lxc_identity) && File.chmod(0400, lxc_identity)
|
214
|
+
lxc_identity
|
215
|
+
end
|
216
|
+
|
217
|
+
################################################################################
|
218
|
+
|
157
219
|
def tag(name=nil)
|
158
220
|
[ name, "v#{Cucumber::Chef::VERSION}" ].compact.join(" ")
|
159
221
|
end
|
160
222
|
|
223
|
+
################################################################################
|
224
|
+
# BOOT
|
161
225
|
################################################################################
|
162
226
|
|
163
|
-
def
|
227
|
+
def boot(name=nil)
|
164
228
|
if !in_chef_repo?
|
165
229
|
message = "It does not look like you are inside a chef-repo! Please relocate to one and execute your command again!"
|
166
230
|
logger.fatal { message }
|
167
231
|
raise message
|
168
232
|
end
|
169
233
|
name and logger.info { "loading #{name}" }
|
170
|
-
logger.info { "
|
234
|
+
logger.info { "boot(#{Cucumber::Chef.config_rb})" }
|
171
235
|
Cucumber::Chef::Config.load
|
172
|
-
|
236
|
+
load_chef_config
|
173
237
|
end
|
174
238
|
|
239
|
+
################################################################################
|
240
|
+
# Load Chef::Config
|
175
241
|
################################################################################
|
176
242
|
|
177
|
-
def
|
243
|
+
def load_chef_config
|
178
244
|
test_lab = (Cucumber::Chef::TestLab.new rescue nil)
|
179
|
-
if (test_lab && (test_lab.labs_running.count > 0))
|
245
|
+
if (test_lab && ((test_lab.labs_running.count rescue 0) > 0))
|
180
246
|
if File.exists?(Cucumber::Chef.knife_rb)
|
181
|
-
logger.info { "
|
247
|
+
logger.info { "load_chef_config(#{Cucumber::Chef.knife_rb})" }
|
182
248
|
::Chef::Config.from_file(Cucumber::Chef.knife_rb)
|
183
249
|
|
184
|
-
chef_server_url = "http://#{test_lab.
|
250
|
+
chef_server_url = "http://#{test_lab.ip}:4000"
|
185
251
|
logger.info { "chef_server_url(#{chef_server_url})" }
|
186
252
|
::Chef::Config[:chef_server_url] = chef_server_url
|
187
253
|
else
|
188
254
|
logger.warn { "We found the test lab; but the knife config '#{Cucumber::Chef.knife_rb}' was missing!" }
|
189
255
|
end
|
190
256
|
else
|
191
|
-
logger.info { "
|
257
|
+
logger.info { "load_chef_config(#{Cucumber::Chef.knife_rb})" }
|
192
258
|
::Chef::Config.from_file(Cucumber::Chef.knife_rb)
|
193
259
|
end
|
194
260
|
end
|
@@ -201,21 +267,23 @@ module Cucumber
|
|
201
267
|
Cucumber::Chef.is_rc? and ($logger.level = ZTK::Logger::DEBUG)
|
202
268
|
|
203
269
|
headers = {
|
204
|
-
"program" => $0.to_s,
|
205
|
-
"
|
206
|
-
"uname" => %x(uname -a).chomp.strip,
|
207
|
-
"chef_repo" => chef_repo,
|
208
|
-
"chef_version" => ::Chef::VERSION,
|
209
|
-
"
|
210
|
-
"
|
211
|
-
"
|
212
|
-
"
|
213
|
-
"
|
214
|
-
"
|
215
|
-
"
|
270
|
+
"program" => $0.to_s.inspect,
|
271
|
+
"cucumber_chef_version" => Cucumber::Chef::VERSION.inspect,
|
272
|
+
"uname" => %x(uname -a).chomp.strip.inspect,
|
273
|
+
"chef_repo" => chef_repo.inspect,
|
274
|
+
"chef_version" => ::Chef::VERSION.inspect,
|
275
|
+
"vagrant_version" => ::Vagrant::VERSION.inspect,
|
276
|
+
"fog_version" => ::Fog::VERSION.inspect,
|
277
|
+
"log_file" => log_file.inspect,
|
278
|
+
# "config_rb" => config_rb,
|
279
|
+
# "knife_rb" => knife_rb,
|
280
|
+
"servers_bin" => servers_bin.inspect,
|
281
|
+
"ruby_version" => RUBY_VERSION.inspect,
|
282
|
+
"ruby_patchlevel" => RUBY_PATCHLEVEL.inspect,
|
283
|
+
"ruby_platform" => RUBY_PLATFORM.inspect
|
216
284
|
}
|
217
285
|
if RUBY_VERSION >= "1.9"
|
218
|
-
headers.merge!("ruby_engine" => RUBY_ENGINE)
|
286
|
+
headers.merge!("ruby_engine" => RUBY_ENGINE.inspect)
|
219
287
|
end
|
220
288
|
max_key_length = headers.keys.collect{ |key| key.to_s.length }.max
|
221
289
|
|
@@ -24,7 +24,7 @@ module Cucumber
|
|
24
24
|
|
25
25
|
################################################################################
|
26
26
|
|
27
|
-
VERSION = "2.1.0.rc.
|
27
|
+
VERSION = "2.1.0.rc.2" unless const_defined?(:VERSION)
|
28
28
|
|
29
29
|
################################################################################
|
30
30
|
|
data/lib/cucumber/chef.rb
CHANGED
@@ -28,7 +28,10 @@ require 'stringio'
|
|
28
28
|
|
29
29
|
require 'chef'
|
30
30
|
require 'chef/cookbook_uploader'
|
31
|
+
|
31
32
|
require 'fog'
|
33
|
+
require 'vagrant'
|
34
|
+
|
32
35
|
require 'json'
|
33
36
|
require 'mixlib/config'
|
34
37
|
require 'ubuntu_ami'
|
@@ -45,7 +48,9 @@ module Cucumber
|
|
45
48
|
|
46
49
|
autoload :Bootstrap, 'cucumber/chef/bootstrap'
|
47
50
|
autoload :Config, 'cucumber/chef/config'
|
51
|
+
autoload :Provider, 'cucumber/chef/provider'
|
48
52
|
autoload :Provisioner, 'cucumber/chef/provisioner'
|
53
|
+
autoload :Server, 'cucumber/chef/server'
|
49
54
|
autoload :TestLab, 'cucumber/chef/test_lab'
|
50
55
|
|
51
56
|
require 'cucumber/chef/utility'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.0.rc.
|
4
|
+
version: 2.1.0.rc.2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-01-
|
13
|
+
date: 2013-01-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: chef
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.10.
|
22
|
+
version: 0.10.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,15 +27,15 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ! '>='
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version: 0.10.
|
30
|
+
version: 0.10.0
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
|
-
name:
|
32
|
+
name: fog
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
none: false
|
35
35
|
requirements:
|
36
36
|
- - ! '>='
|
37
37
|
- !ruby/object:Gem::Version
|
38
|
-
version: 1.
|
38
|
+
version: 1.3.1
|
39
39
|
type: :runtime
|
40
40
|
prerelease: false
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,15 +43,15 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - ! '>='
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 1.
|
46
|
+
version: 1.3.1
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: vagrant
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.0.5
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -59,15 +59,15 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - ! '>='
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 1.
|
62
|
+
version: 1.0.5
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
|
-
name:
|
64
|
+
name: cucumber
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
66
66
|
none: false
|
67
67
|
requirements:
|
68
68
|
- - ! '>='
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: 1.
|
70
|
+
version: 1.2.0
|
71
71
|
type: :runtime
|
72
72
|
prerelease: false
|
73
73
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -75,7 +75,23 @@ dependencies:
|
|
75
75
|
requirements:
|
76
76
|
- - ! '>='
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version: 1.
|
78
|
+
version: 1.2.0
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: rspec
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 2.10.0
|
87
|
+
type: :runtime
|
88
|
+
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 2.10.0
|
79
95
|
- !ruby/object:Gem::Dependency
|
80
96
|
name: thor
|
81
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,13 +109,13 @@ dependencies:
|
|
93
109
|
- !ruby/object:Gem::Version
|
94
110
|
version: 0.15.2
|
95
111
|
- !ruby/object:Gem::Dependency
|
96
|
-
name:
|
112
|
+
name: mixlib-config
|
97
113
|
requirement: !ruby/object:Gem::Requirement
|
98
114
|
none: false
|
99
115
|
requirements:
|
100
116
|
- - ! '>='
|
101
117
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
118
|
+
version: 1.1.2
|
103
119
|
type: :runtime
|
104
120
|
prerelease: false
|
105
121
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -107,15 +123,15 @@ dependencies:
|
|
107
123
|
requirements:
|
108
124
|
- - ! '>='
|
109
125
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
126
|
+
version: 1.1.2
|
111
127
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
128
|
+
name: rake
|
113
129
|
requirement: !ruby/object:Gem::Requirement
|
114
130
|
none: false
|
115
131
|
requirements:
|
116
132
|
- - ! '>='
|
117
133
|
- !ruby/object:Gem::Version
|
118
|
-
version: 0.
|
134
|
+
version: 0.9.2
|
119
135
|
type: :runtime
|
120
136
|
prerelease: false
|
121
137
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -123,15 +139,15 @@ dependencies:
|
|
123
139
|
requirements:
|
124
140
|
- - ! '>='
|
125
141
|
- !ruby/object:Gem::Version
|
126
|
-
version: 0.
|
142
|
+
version: 0.9.2
|
127
143
|
- !ruby/object:Gem::Dependency
|
128
|
-
name:
|
144
|
+
name: ubuntu_ami
|
129
145
|
requirement: !ruby/object:Gem::Requirement
|
130
146
|
none: false
|
131
147
|
requirements:
|
132
148
|
- - ! '>='
|
133
149
|
- !ruby/object:Gem::Version
|
134
|
-
version:
|
150
|
+
version: 0.4.0
|
135
151
|
type: :runtime
|
136
152
|
prerelease: false
|
137
153
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -139,7 +155,7 @@ dependencies:
|
|
139
155
|
requirements:
|
140
156
|
- - ! '>='
|
141
157
|
- !ruby/object:Gem::Version
|
142
|
-
version:
|
158
|
+
version: 0.4.0
|
143
159
|
- !ruby/object:Gem::Dependency
|
144
160
|
name: ztk
|
145
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -292,7 +308,11 @@ files:
|
|
292
308
|
- lib/cucumber/chef/helpers/server.rb
|
293
309
|
- lib/cucumber/chef/helpers/test_lab.rb
|
294
310
|
- lib/cucumber/chef/helpers/utility.rb
|
311
|
+
- lib/cucumber/chef/provider.rb
|
312
|
+
- lib/cucumber/chef/providers/aws.rb
|
313
|
+
- lib/cucumber/chef/providers/vagrant.rb
|
295
314
|
- lib/cucumber/chef/provisioner.rb
|
315
|
+
- lib/cucumber/chef/server.rb
|
296
316
|
- lib/cucumber/chef/steps.rb
|
297
317
|
- lib/cucumber/chef/steps/chef_steps.rb
|
298
318
|
- lib/cucumber/chef/steps/minitest_steps.rb
|