kitchen-rackspace 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b38ffcc8eb26f872550c5ec737ed5066857fb6c4
4
- data.tar.gz: 68bdd5ae2e14296e510c3459441e1ad898c1ec38
3
+ metadata.gz: 02c665cc850869f22e3b31463bc869f67d11b8e7
4
+ data.tar.gz: 8ae8afc951aa645aedb9e30edc1a198b80b9991d
5
5
  SHA512:
6
- metadata.gz: bf5a93011bdb76cf76162077670dc66c6db8a0dd41c91a00d8bcc394c0b99ae8fd5a079b5652af8c39d7a1fe73ceadf337c9864c05fb06d8829bbe4b92e74bf9
7
- data.tar.gz: 1402487a8c35aacbd2189b1e020fe5c9c23bc3fc549137e80267313eef581e03f354fa0fdc83bffdf07647a966ba9ddb1fa5e32e5e736a2e6bb744fe3f140f4c
6
+ metadata.gz: 45dcd888d5027beb598964b12c84abd12ef48c48d7010f3040b44556fea280307e1661276d2df02ecb1de1da154ad9ffefea876b2a9931332d05c2521792554c
7
+ data.tar.gz: fbade3eb3f36f632c1960ccc52fc20c4fc7987ce1c74cb418b6f5ba92ecb54f72487632c379e0b5a5ea20a65779ca957092c71126b6710f12c3812ca615444d0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # 0.12.0 / 2014-09-10
2
+
3
+ ### New Features
4
+
5
+ * PR [#41][] - Support optionally using ServiceNet for SSH access, via
6
+ [@steve-jansen][]
7
+
1
8
  # 0.11.0 / 2014-09-04
2
9
 
3
10
  ### Improvements
@@ -97,6 +104,7 @@ boot times, via [@coderanger][]
97
104
 
98
105
  * Initial release! Woo!
99
106
 
107
+ [#41]: https://github.com/test-kitchen/kitchen-rackspace/pull/41
100
108
  [#40]: https://github.com/test-kitchen/kitchen-rackspace/pull/40
101
109
  [#39]: https://github.com/test-kitchen/kitchen-rackspace/pull/39
102
110
  [#38]: https://github.com/test-kitchen/kitchen-rackspace/pull/38
@@ -117,6 +125,7 @@ boot times, via [@coderanger][]
117
125
  [#8]: https://github.com/test-kitchen/kitchen-rackspace/pull/8
118
126
  [#7]: https://github.com/test-kitchen/kitchen-rackspace/pull/7
119
127
 
128
+ [@steve-jansen]: https://github.com/steve-jansen
120
129
  [@hhoover]: https://github.com/hhoover
121
130
  [@kanerogers]: https://github.com/kanerogers
122
131
  [@martinb3]: https://github.com/martinb3
data/README.md CHANGED
@@ -42,7 +42,7 @@ for your specified platform. Additional, optional overrides can be provided:
42
42
 
43
43
  image_id: [SERVER IMAGE ID]
44
44
  flavor_id: [SERVER FLAVOR ID]
45
- server_name: [A UNIQUE SERVER NAME]
45
+ server_name: [A FRIENDLY SERVER NAME]
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]
@@ -50,6 +50,7 @@ for your specified platform. Additional, optional overrides can be provided:
50
50
  no_ssh_tcp_check_sleep: [NUM OF SECONDS TO SLEEP IF no_ssh_tcp_check IS SET]
51
51
  networks: [LIST OF RACKSPACE NETWORK UUIDS, DEFAULT PUBLICNET AND SERVICE NET]
52
52
  rackconnect_wait: ['true' IF USING RACKCONNECT TO WAIT FOR IT TO COMPLETE]
53
+ servicenet: ['true' IF USING THE SERVICENET IP ADDRESS TO CONNECT]
53
54
 
54
55
  You also have the option of providing some configs via environment variables:
55
56
 
@@ -66,7 +67,9 @@ Some configs are also derived based on your .ssh directory, specifically the
66
67
  ## Contributing
67
68
 
68
69
  1. Fork it
69
- 2. Create your feature branch (`git checkout -b my-new-feature`)
70
- 3. Commit your changes (`git commit -am 'Add some feature'`)
71
- 4. Push to the branch (`git push origin my-new-feature`)
72
- 5. Create new Pull Request
70
+ 2. `bundle install`
71
+ 3. Create your feature branch (`git checkout -b my-new-feature`)
72
+ 4. `bundle exec rake` must pass
73
+ 5. Commit your changes (`git commit -am 'Add some feature'`)
74
+ 6. Push to the branch (`git push origin my-new-feature`)
75
+ 7. Create new Pull Request
@@ -37,6 +37,7 @@ module Kitchen
37
37
  default_config :no_ssh_tcp_check, false
38
38
  default_config :no_ssh_tcp_check_sleep, 120
39
39
  default_config :rackconnect_wait, false
40
+ default_config :servicenet, false
40
41
  default_config(:image_id) { |driver| driver.default_image }
41
42
  default_config(:server_name) { |driver| driver.default_name }
42
43
  default_config :networks, nil
@@ -75,7 +76,7 @@ module Kitchen
75
76
  server.wait_for { ready? }
76
77
  puts '(server ready)'
77
78
  rackconnect_check(server) if config[:rackconnect_wait]
78
- state[:hostname] = server.public_ip_address
79
+ state[:hostname] = hostname(server)
79
80
  tcp_check(state)
80
81
  rescue Fog::Errors::Error, Excon::Errors::Error => ex
81
82
  raise ActionFailed, ex.message
@@ -156,6 +157,14 @@ module Kitchen
156
157
  server.update # refresh accessIPv4 with new IP
157
158
  end
158
159
 
160
+ def hostname(server)
161
+ if config[:servicenet] == false
162
+ server.public_ip_address
163
+ else
164
+ server.private_ip_address
165
+ end
166
+ end
167
+
159
168
  def networks
160
169
  base_nets = %w(
161
170
  00000000-0000-0000-0000-000000000000
@@ -21,6 +21,6 @@ module Kitchen
21
21
  #
22
22
  # @author Jonathan Hartman <j@p4nt5.com>
23
23
  module Driver
24
- RACKSPACE_VERSION = '0.11.0'
24
+ RACKSPACE_VERSION = '0.12.0'
25
25
  end
26
26
  end
@@ -113,6 +113,10 @@ describe Kitchen::Driver::Rackspace do
113
113
  it 'defaults to not waiting for rackconnect' do
114
114
  expect(driver[:rackconnect_wait]).to eq(false)
115
115
  end
116
+
117
+ it 'defaults to the public ip address' do
118
+ expect(driver[:servicenet]).to eq(false)
119
+ end
116
120
  end
117
121
 
118
122
  platforms = {
@@ -143,7 +147,8 @@ describe Kitchen::Driver::Rackspace do
143
147
  server_name: 'puppy',
144
148
  rackspace_region: 'ord',
145
149
  wait_for: 1200,
146
- rackconnect_wait: true
150
+ rackconnect_wait: true,
151
+ use_private_ip_address: true
147
152
  }
148
153
 
149
154
  let(:config) { config }
@@ -223,7 +228,108 @@ describe Kitchen::Driver::Rackspace do
223
228
  driver.create(state)
224
229
  end
225
230
  end
231
+ end
232
+
233
+ describe '#create and rackconnect_wait' do
234
+ let(:server) do
235
+ double(id: 'test123',
236
+ wait_for: true,
237
+ public_ip_address: '1.2.3.4',
238
+ private_ip_address: '10.9.8.7',
239
+ update: nil)
240
+ end
241
+ let(:driver) do
242
+ d = Kitchen::Driver::Rackspace.new(config)
243
+ d.instance = instance
244
+ allow(d).to receive(:default_name).and_return('a_monkey!')
245
+ allow(d).to receive(:create_server).and_return(server)
246
+ allow(d).to receive(:tcp_check).and_return(true)
247
+ d
248
+ end
226
249
 
250
+ context 'username and API key only provided' do
251
+ let(:config) do
252
+ {
253
+ rackspace_username: 'hello',
254
+ rackspace_api_key: 'world',
255
+ wait_for: 1200,
256
+ rackconnect_wait: true
257
+ }
258
+ end
259
+
260
+ it 'generates a server name in the absence of one' do
261
+ driver.create(state)
262
+ expect(driver[:server_name]).to eq('a_monkey!')
263
+ end
264
+
265
+ it 'gets a proper server ID' do
266
+ driver.create(state)
267
+ expect(state[:server_id]).to eq('test123')
268
+ end
269
+
270
+ it 'gets a proper hostname (IP)' do
271
+ driver.create(state)
272
+ expect(state[:hostname]).to eq('1.2.3.4')
273
+ end
274
+
275
+ it 'calls tcp_check' do
276
+ expect(driver).to receive(:tcp_check)
277
+ driver.create(state)
278
+ end
279
+
280
+ it 'calls rackconnect_check ' do
281
+ expect(driver).to receive(:rackconnect_check)
282
+ driver.create(state)
283
+ end
284
+
285
+ it 'rackconnect_check waits for rackconnect_automation' do
286
+ expect(server).to receive(:wait_for)
287
+ driver.send(:rackconnect_check, server)
288
+ end
289
+ end
290
+ end
291
+
292
+ describe '#create and use_private_ip_address' do
293
+ let(:server) do
294
+ double(id: 'test123',
295
+ wait_for: true,
296
+ public_ip_address: '1.2.3.4',
297
+ private_ip_address: '10.9.8.7')
298
+ end
299
+ let(:driver) do
300
+ d = Kitchen::Driver::Rackspace.new(config)
301
+ d.instance = instance
302
+ allow(d).to receive(:default_name).and_return('a_monkey!')
303
+ allow(d).to receive(:create_server).and_return(server)
304
+ allow(d).to receive(:tcp_check).and_return(true)
305
+ d
306
+ end
307
+
308
+ context 'username and API key only provided' do
309
+ let(:config) do
310
+ {
311
+ rackspace_username: 'hello',
312
+ rackspace_api_key: 'world',
313
+ wait_for: 1200,
314
+ servicenet: true
315
+ }
316
+ end
317
+
318
+ it 'generates a server name in the absence of one' do
319
+ driver.create(state)
320
+ expect(driver[:server_name]).to eq('a_monkey!')
321
+ end
322
+
323
+ it 'gets a proper server ID' do
324
+ driver.create(state)
325
+ expect(state[:server_id]).to eq('test123')
326
+ end
327
+
328
+ it 'gets a private ip as the hostname' do
329
+ driver.create(state)
330
+ expect(state[:hostname]).to eq('10.9.8.7')
331
+ end
332
+ end
227
333
  end
228
334
 
229
335
  describe '#destroy' do
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.11.0
4
+ version: 0.12.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-09-04 00:00:00.000000000 Z
11
+ date: 2014-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen