kitchen-rackspace 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +11 -1
- data/lib/kitchen/driver/rackspace.rb +33 -28
- data/lib/kitchen/driver/rackspace_version.rb +1 -1
- data/spec/kitchen/driver/rackspace_spec.rb +104 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e320297bfe8e683d298155da6bf1864c420b3691
|
|
4
|
+
data.tar.gz: 633656517754c67fc5aa1f466f0e6a4430552d37
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 14d8e600b6b7eff9799fc3e084552528688cbe88d8033b5e4e2e518b8049b3e95866e93cfd4898475ad9cbb31f3f5173109113b8e090e8f63b9c2a9873ce051d
|
|
7
|
+
data.tar.gz: a6c176366ffea6994bd71d252d5deb92743e711a3e64135867b5fde52734e67b670b4c13d92a15fe1074babf9be50f8df65d6d49ac2355d923fa6cd527f36f51
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
# 0.7.0 / 2014-07-09
|
|
2
|
+
|
|
3
|
+
### New Features
|
|
4
|
+
|
|
5
|
+
* PR [#31][] - Support attaching to custom networks, via [@kanerogers][]
|
|
6
|
+
* PR [#29][] - Support using a sleep instead of TCP check in cases where new
|
|
7
|
+
servers might fail the TCP; via [@martinb3][]
|
|
8
|
+
|
|
1
9
|
# 0.6.1 / 2014-06-03
|
|
2
10
|
|
|
3
11
|
### Bug Fixes
|
|
@@ -62,6 +70,8 @@ boot times, via [@coderanger][]
|
|
|
62
70
|
|
|
63
71
|
* Initial release! Woo!
|
|
64
72
|
|
|
73
|
+
[#31]: https://github.com/test-kitchen/kitchen-rackspace/pull/31
|
|
74
|
+
[#29]: https://github.com/test-kitchen/kitchen-rackspace/pull/29
|
|
65
75
|
[#26]: https://github.com/test-kitchen/kitchen-rackspace/pull/26
|
|
66
76
|
[#25]: https://github.com/test-kitchen/kitchen-rackspace/pull/25
|
|
67
77
|
[#24]: https://github.com/test-kitchen/kitchen-rackspace/pull/24
|
|
@@ -74,6 +84,8 @@ boot times, via [@coderanger][]
|
|
|
74
84
|
[#8]: https://github.com/test-kitchen/kitchen-rackspace/pull/8
|
|
75
85
|
[#7]: https://github.com/test-kitchen/kitchen-rackspace/pull/7
|
|
76
86
|
|
|
87
|
+
[@kanerogers]: https://github.com/kanerogers
|
|
88
|
+
[@martinb3]: https://github.com/martinb3
|
|
77
89
|
[@pezholio]: https://github.com/pezholio
|
|
78
90
|
[@coderanger]: https://github.com/coderanger
|
|
79
91
|
[@claco]: https://github.com/claco
|
data/README.md
CHANGED
|
@@ -33,7 +33,7 @@ Provide, at a minimum, the required driver options in your `.kitchen.yml` file:
|
|
|
33
33
|
name: rackspace
|
|
34
34
|
rackspace_username: [YOUR RACKSPACE CLOUD USERNAME]
|
|
35
35
|
rackspace_api_key: [YOUR RACKSPACE CLOUD API KEY]
|
|
36
|
-
require_chef_omnibus:
|
|
36
|
+
require_chef_omnibus: [e.g. 'true' or a version number if you need Chef]
|
|
37
37
|
platforms:
|
|
38
38
|
- name: [A PLATFORM NAME, e.g. 'centos-6']
|
|
39
39
|
|
|
@@ -46,12 +46,22 @@ for your specified platform. Additional, optional overrides can be provided:
|
|
|
46
46
|
public_key_path: [PATH TO YOUR PUBLIC SSH KEY]
|
|
47
47
|
rackspace_region: [A VALID RACKSPACE DC/REGION]
|
|
48
48
|
wait_for: [NUM OF SECONDS TO WAIT BEFORE TIMING OUT, DEFAULT 600]
|
|
49
|
+
no_ssh_tcp_check: [DEFAULTS TO false, SKIPS TCP CHECK WHEN true]
|
|
50
|
+
no_ssh_tcp_check_sleep: [NUM OF SECONDS TO SLEEP IF no_ssh_tcp_check IS SET]
|
|
51
|
+
networks: [LIST OF RACKSPACE NETWORK UUIDS, DEFAULT PUBLICNET AND SERVICE NET]
|
|
49
52
|
|
|
50
53
|
You also have the option of providing some configs via environment variables:
|
|
51
54
|
|
|
52
55
|
export RACKSPACE_USERNAME="user" # (or OS_USERNAME)
|
|
53
56
|
export RACKSPACE_API_KEY="api_key" # (or OS_PASSWORD)
|
|
54
57
|
|
|
58
|
+
Some configs are also derived based on your .ssh directory, specifically the
|
|
59
|
+
`public_key_path` setting is derived by searching for:
|
|
60
|
+
- `~/.ssh/id_rsa.pub`
|
|
61
|
+
- `~/.ssh/id_dsa.pub`
|
|
62
|
+
- `~/.ssh/identity.pub`
|
|
63
|
+
- `~/.ssh/id_ecdsa.pub`
|
|
64
|
+
|
|
55
65
|
## Contributing
|
|
56
66
|
|
|
57
67
|
1. Fork it
|
|
@@ -34,14 +34,11 @@ module Kitchen
|
|
|
34
34
|
default_config :port, '22'
|
|
35
35
|
default_config :rackspace_region, 'dfw'
|
|
36
36
|
default_config :wait_for, 600
|
|
37
|
-
|
|
38
|
-
default_config :
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
default_config :server_name do |driver|
|
|
43
|
-
driver.default_name
|
|
44
|
-
end
|
|
37
|
+
default_config :no_ssh_tcp_check, false
|
|
38
|
+
default_config :no_ssh_tcp_check_sleep, 120
|
|
39
|
+
default_config(:image_id) { |driver| driver.default_image }
|
|
40
|
+
default_config(:server_name) { |driver| driver.default_name }
|
|
41
|
+
default_config :networks, nil
|
|
45
42
|
|
|
46
43
|
default_config :public_key_path do
|
|
47
44
|
[
|
|
@@ -77,8 +74,7 @@ module Kitchen
|
|
|
77
74
|
server.wait_for { ready? }
|
|
78
75
|
puts '(server ready)'
|
|
79
76
|
state[:hostname] = server.public_ip_address
|
|
80
|
-
|
|
81
|
-
puts '(ssh ready)'
|
|
77
|
+
tcp_check(state)
|
|
82
78
|
rescue Fog::Errors::Error, Excon::Errors::Error => ex
|
|
83
79
|
raise ActionFailed, ex.message
|
|
84
80
|
end
|
|
@@ -106,36 +102,45 @@ module Kitchen
|
|
|
106
102
|
private
|
|
107
103
|
|
|
108
104
|
def compute
|
|
109
|
-
server_def = {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
if config[:rackspace_region]
|
|
116
|
-
server_def[:rackspace_region] = config[:rackspace_region]
|
|
105
|
+
server_def = { provider: 'Rackspace' }
|
|
106
|
+
opts = [:version, :rackspace_username, :rackspace_api_key,
|
|
107
|
+
:rackspace_region]
|
|
108
|
+
opts.each do |opt|
|
|
109
|
+
server_def[opt] = config[opt]
|
|
117
110
|
end
|
|
118
111
|
Fog::Compute.new(server_def)
|
|
119
112
|
end
|
|
120
113
|
|
|
121
114
|
def create_server
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
)
|
|
115
|
+
server_def = { name: config[:server_name], networks: networks }
|
|
116
|
+
[:image_id, :flavor_id, :public_key_path].each do |opt|
|
|
117
|
+
server_def[opt] = config[opt]
|
|
118
|
+
end
|
|
119
|
+
compute.servers.bootstrap(server_def)
|
|
128
120
|
end
|
|
129
121
|
|
|
130
122
|
def images
|
|
131
123
|
@images ||= begin
|
|
132
|
-
json_file = File.expand_path(
|
|
133
|
-
File.join(%w(.. .. .. .. data images.json)),
|
|
134
|
-
__FILE__
|
|
135
|
-
)
|
|
124
|
+
json_file = File.expand_path('../../../../data/images.json', __FILE__)
|
|
136
125
|
JSON.load(IO.read(json_file))
|
|
137
126
|
end
|
|
138
127
|
end
|
|
128
|
+
|
|
129
|
+
def tcp_check(state)
|
|
130
|
+
# allow driver config to bypass SSH tcp check -- because
|
|
131
|
+
# it doesn't respect ssh_config values that might be required
|
|
132
|
+
wait_for_sshd(state[:hostname]) unless config[:no_ssh_tcp_check]
|
|
133
|
+
sleep(config[:no_ssh_tcp_check_sleep]) if config[:no_ssh_tcp_check]
|
|
134
|
+
puts '(ssh ready)'
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def networks
|
|
138
|
+
base_nets = %w(
|
|
139
|
+
00000000-0000-0000-0000-000000000000
|
|
140
|
+
11111111-1111-1111-1111-111111111111
|
|
141
|
+
)
|
|
142
|
+
config[:networks] ? base_nets + config[:networks] : nil
|
|
143
|
+
end
|
|
139
144
|
end
|
|
140
145
|
end
|
|
141
146
|
end
|
|
@@ -29,6 +29,7 @@ describe Kitchen::Driver::Rackspace do
|
|
|
29
29
|
let(:config) { Hash.new }
|
|
30
30
|
let(:state) { Hash.new }
|
|
31
31
|
let(:platform_name) { 'ubuntu' }
|
|
32
|
+
let(:default_networks) { nil }
|
|
32
33
|
|
|
33
34
|
let(:instance) do
|
|
34
35
|
double(
|
|
@@ -95,6 +96,18 @@ describe Kitchen::Driver::Rackspace do
|
|
|
95
96
|
expect(driver[:wait_for]).to eq(600)
|
|
96
97
|
expect(Fog).to have_received(:timeout=).with(600)
|
|
97
98
|
end
|
|
99
|
+
|
|
100
|
+
it 'defaults the SSH TCP bypassing to false' do
|
|
101
|
+
expect(driver[:no_ssh_tcp_check]).to eq(false)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
it 'defaults the TCP bypass sleep time to 120 seconds' do
|
|
105
|
+
expect(driver[:no_ssh_tcp_check_sleep]).to eq(120)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
it 'defaults to the standard Rackspace networks' do
|
|
109
|
+
expect(driver[:networks]).to eq(default_networks)
|
|
110
|
+
end
|
|
98
111
|
end
|
|
99
112
|
|
|
100
113
|
platforms = {
|
|
@@ -161,7 +174,8 @@ describe Kitchen::Driver::Rackspace do
|
|
|
161
174
|
|
|
162
175
|
describe '#create' do
|
|
163
176
|
let(:server) do
|
|
164
|
-
double(id: 'test123',
|
|
177
|
+
double(id: 'test123',
|
|
178
|
+
wait_for: true,
|
|
165
179
|
public_ip_address: '1.2.3.4')
|
|
166
180
|
end
|
|
167
181
|
let(:driver) do
|
|
@@ -170,7 +184,7 @@ describe Kitchen::Driver::Rackspace do
|
|
|
170
184
|
d.instance = instance
|
|
171
185
|
allow(d).to receive(:default_name).and_return('a_monkey!')
|
|
172
186
|
allow(d).to receive(:create_server).and_return(server)
|
|
173
|
-
allow(d).to receive(:
|
|
187
|
+
allow(d).to receive(:tcp_check).and_return(true)
|
|
174
188
|
d
|
|
175
189
|
end
|
|
176
190
|
|
|
@@ -197,7 +211,13 @@ describe Kitchen::Driver::Rackspace do
|
|
|
197
211
|
driver.create(state)
|
|
198
212
|
expect(state[:hostname]).to eq('1.2.3.4')
|
|
199
213
|
end
|
|
214
|
+
|
|
215
|
+
it 'calls tcp_check' do
|
|
216
|
+
expect(driver).to receive(:tcp_check)
|
|
217
|
+
driver.create(state)
|
|
218
|
+
end
|
|
200
219
|
end
|
|
220
|
+
|
|
201
221
|
end
|
|
202
222
|
|
|
203
223
|
describe '#destroy' do
|
|
@@ -299,7 +319,8 @@ describe Kitchen::Driver::Rackspace do
|
|
|
299
319
|
server_name: 'hello',
|
|
300
320
|
image_id: 'there',
|
|
301
321
|
flavor_id: 'captain',
|
|
302
|
-
public_key_path: 'tarpals'
|
|
322
|
+
public_key_path: 'tarpals',
|
|
323
|
+
networks: default_networks
|
|
303
324
|
}
|
|
304
325
|
end
|
|
305
326
|
before(:each) do
|
|
@@ -324,6 +345,40 @@ describe Kitchen::Driver::Rackspace do
|
|
|
324
345
|
it 'creates the server using a compute connection' do
|
|
325
346
|
expect(driver.send(:create_server)).to eq(@expected)
|
|
326
347
|
end
|
|
348
|
+
|
|
349
|
+
context 'additional networks specified' do
|
|
350
|
+
let(:server_id) { '12345' }
|
|
351
|
+
let(:server) do
|
|
352
|
+
double(id: 'test123', wait_for: true,
|
|
353
|
+
public_ip_address: '1.2.3.4')
|
|
354
|
+
end
|
|
355
|
+
let(:hostname) { 'example.com' }
|
|
356
|
+
let(:servers_double) { double('servers', bootstrap: server) }
|
|
357
|
+
let(:compute_double) { double(Fog::Compute, servers: servers_double) }
|
|
358
|
+
let(:state) { { server_id: server_id, hostname: hostname } }
|
|
359
|
+
let(:driver) do
|
|
360
|
+
d = Kitchen::Driver::Rackspace.new(config)
|
|
361
|
+
allow(d).to receive(:wait_for_sshd).with('1.2.3.4').and_return(true)
|
|
362
|
+
d.instance = instance
|
|
363
|
+
allow(Fog::Compute).to receive(:new).and_return(compute_double)
|
|
364
|
+
d
|
|
365
|
+
end
|
|
366
|
+
let(:user_specified_network) { 'bob_dole' }
|
|
367
|
+
let(:config) do
|
|
368
|
+
{
|
|
369
|
+
rackspace_username: 'monkey',
|
|
370
|
+
rackspace_api_key: 'potato',
|
|
371
|
+
rackspace_region: 'ord',
|
|
372
|
+
networks: [user_specified_network]
|
|
373
|
+
}
|
|
374
|
+
end
|
|
375
|
+
it 'has the user specified network, plus default Rackspace networks' do
|
|
376
|
+
driver.create(state)
|
|
377
|
+
expect(servers_double).to have_received(:bootstrap) do |arg|
|
|
378
|
+
expect(arg[:networks][2]).to eq user_specified_network
|
|
379
|
+
end
|
|
380
|
+
end
|
|
381
|
+
end
|
|
327
382
|
end
|
|
328
383
|
|
|
329
384
|
describe '#default_name' do
|
|
@@ -337,4 +392,50 @@ describe Kitchen::Driver::Rackspace do
|
|
|
337
392
|
/^potatoes-user-host-/)
|
|
338
393
|
end
|
|
339
394
|
end
|
|
395
|
+
|
|
396
|
+
describe '#tcp_check' do
|
|
397
|
+
before(:each) do
|
|
398
|
+
allow_any_instance_of(described_class).to receive(:wait_for_sshd)
|
|
399
|
+
allow_any_instance_of(described_class).to receive(:sleep)
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
context 'the default non-skipping behavior' do
|
|
403
|
+
it "uses Kitchen's own SSH check" do
|
|
404
|
+
expect(driver).to receive(:wait_for_sshd)
|
|
405
|
+
expect(driver).to_not receive(:sleep)
|
|
406
|
+
driver.send(:tcp_check, state)
|
|
407
|
+
end
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
context 'a config set to wait instead of TCP check' do
|
|
411
|
+
let(:config) { { no_ssh_tcp_check: true } }
|
|
412
|
+
|
|
413
|
+
it 'uses a sleep instead of a port check' do
|
|
414
|
+
expect(driver).to_not receive(:wait_for_sshd)
|
|
415
|
+
expect(driver).to receive(:sleep)
|
|
416
|
+
driver.send(:tcp_check, state)
|
|
417
|
+
end
|
|
418
|
+
end
|
|
419
|
+
end
|
|
420
|
+
|
|
421
|
+
describe '#networks' do
|
|
422
|
+
context 'the default Rackspace networks' do
|
|
423
|
+
it 'returns nil so Fog will use the defaults' do
|
|
424
|
+
expect(driver.send(:networks)).to eq(nil)
|
|
425
|
+
end
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
context 'a custom Rackspace network' do
|
|
429
|
+
let(:config) { { networks: %w(abcdefg) } }
|
|
430
|
+
|
|
431
|
+
it 'returns the base networks plus the custom one' do
|
|
432
|
+
expected = %w(
|
|
433
|
+
00000000-0000-0000-0000-000000000000
|
|
434
|
+
11111111-1111-1111-1111-111111111111
|
|
435
|
+
abcdefg
|
|
436
|
+
)
|
|
437
|
+
expect(driver.send(:networks)).to eq(expected)
|
|
438
|
+
end
|
|
439
|
+
end
|
|
440
|
+
end
|
|
340
441
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kitchen-rackspace
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jonathan Hartman
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-07-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: test-kitchen
|