kitchen-openstack 2.2.0 → 3.0.0.pre.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7cc5aec52bdc2147c02da6c0d1b87ec2bc138e54
4
- data.tar.gz: d224fb8f09f751cf847c5c19fbd5457562019dd7
3
+ metadata.gz: 107c030eb921cc95686b8fba8975a0dc334b92cf
4
+ data.tar.gz: c25fd06642e32c85345d449ff2299b015aaff3da
5
5
  SHA512:
6
- metadata.gz: 02e017f2e65efda1f0ed458a626795550f42b6c441f4dfb0e524b09a59abd4bb0c3c294509d8c4280d4edb5eac2d59136d8d98ca2891b935da027849e21e88de
7
- data.tar.gz: ef9055f193441af5676c90f2572589c4c9c75ad19f0ad30b4cab8166dc88344d679db6f64dc96b9710fc5d9de4beb65db03e2c485b77f86c36145e14dce2fdc1
6
+ metadata.gz: af0616b8cde893ecdc6ff864d84e27e496d74985feccff2d7a89038a22dfa87e5347a77868c13efcd424689fd137d66f97fd19dc67fb7bded8b8e61e0fd939aa
7
+ data.tar.gz: 3a0358955de8b5184cb0174c4ff26973ca89aecfc7ba6c66c7f6578cfa49ff16efc6f7601017d6af072d46247f4842654a5fbe0825c7009b99e5f5abbc76f6b7
data/README.md CHANGED
@@ -128,14 +128,6 @@ driver:
128
128
  user_data: cloud_init
129
129
  ```
130
130
 
131
- ### username
132
-
133
- **Deprecated** SSH User name, you should be using transport now.
134
-
135
- ### password
136
-
137
- **Deprecated** SSH password, you should be using transport now.
138
-
139
131
  ### port
140
132
 
141
133
  Set the SSH port for the remote access.
@@ -228,7 +220,7 @@ to be set to `true`.
228
220
 
229
221
  ## Disk Configuration
230
222
 
231
- ### <a name="config-block_device_mappings"></a> block\_device\_mappings
223
+ ### <a name="config-block_device_mapping"></a> block\_device\_mapping
232
224
 
233
225
  #### make\_volume
234
226
 
@@ -269,7 +261,7 @@ Timeout to wait for volume to become available. If a large volume is provisione
269
261
  #### Example
270
262
 
271
263
  ```yaml
272
- block_device_mappings:
264
+ block_device_mapping:
273
265
  make_volume: true
274
266
  snapshot_id: 00000-111111-0000222-000
275
267
  device_name: vda
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_development_dependency 'bundler'
30
30
  spec.add_development_dependency 'rake'
31
- spec.add_development_dependency 'rubocop'
31
+ spec.add_development_dependency 'rubocop', '~> 0.36'
32
32
  spec.add_development_dependency 'cane'
33
33
  spec.add_development_dependency 'countloc'
34
34
  spec.add_development_dependency 'rspec'
@@ -4,7 +4,7 @@
4
4
  # Author:: JJ Asghar (<jj@chef.io>)
5
5
  #
6
6
  # Copyright (C) 2013-2015, Jonathan Hartman
7
- # Copyright (C) 2015, Chef Inc
7
+ # Copyright (C) 2015-2016, Chef Inc
8
8
  #
9
9
  # Licensed under the Apache License, Version 2.0 (the "License");
10
10
  # you may not use this file except in compliance with the License.
@@ -45,8 +45,6 @@ module Kitchen
45
45
  default_config :public_key_path do |driver|
46
46
  driver[:private_key_path] + '.pub' if driver[:private_key_path]
47
47
  end
48
- default_config :username, 'root'
49
- default_config :password, nil
50
48
  default_config :port, '22'
51
49
  default_config :use_ipv6, false
52
50
  default_config :openstack_tenant, nil
@@ -62,14 +60,13 @@ module Kitchen
62
60
  default_config :network_ref, nil
63
61
  default_config :no_ssh_tcp_check, false
64
62
  default_config :no_ssh_tcp_check_sleep, 120
65
- default_config :winrm_wait, nil
66
63
  default_config :glance_cache_wait_timeout, 600
67
64
  default_config :block_device_mapping, nil
68
65
 
69
66
  required_config :private_key_path
70
67
  required_config :public_key_path do |_, value, driver|
71
68
  if value.nil? && driver[:key_name].nil?
72
- fail(UserError,
69
+ fail(UserError, # rubocop:disable SignalException
73
70
  'Either a `:public_key_path` or `:key_name` is required')
74
71
  end
75
72
  end
@@ -112,7 +109,6 @@ module Kitchen
112
109
  end
113
110
  state[:hostname] = get_ip(server)
114
111
  wait_for_server(state)
115
- setup_ssh(server, state) if bourne_shell?
116
112
  add_ohai_hint(state)
117
113
  rescue Fog::Errors::Error, Excon::Errors::Error => ex
118
114
  raise ActionFailed, ex.message
@@ -216,21 +212,21 @@ module Kitchen
216
212
 
217
213
  def find_image(image_ref)
218
214
  image = find_matching(compute.images, image_ref)
219
- fail(ActionFailed, 'Image not found') unless image
215
+ fail(ActionFailed, 'Image not found') unless image # rubocop:disable Metrics/LineLength, SignalException
220
216
  debug "Selected image: #{image.id} #{image.name}"
221
217
  image
222
218
  end
223
219
 
224
220
  def find_flavor(flavor_ref)
225
221
  flavor = find_matching(compute.flavors, flavor_ref)
226
- fail(ActionFailed, 'Flavor not found') unless flavor
222
+ fail(ActionFailed, 'Flavor not found') unless flavor # rubocop:disable Metrics/LineLength, SignalException
227
223
  debug "Selected flavor: #{flavor.id} #{flavor.name}"
228
224
  flavor
229
225
  end
230
226
 
231
227
  def find_network(network_ref)
232
228
  net = find_matching(network.networks.all, network_ref)
233
- fail(ActionFailed, 'Network not found') unless net
229
+ fail(ActionFailed, 'Network not found') unless net # rubocop:disable Metrics/LineLength, SignalException
234
230
  debug "Selected net: #{net.id} #{net.name}"
235
231
  net
236
232
  end
@@ -285,7 +281,7 @@ module Kitchen
285
281
  i.ip if i.fixed_ip.nil? && i.instance_id.nil? && i.pool == pool
286
282
  end.compact
287
283
  if free_addrs.empty?
288
- fail ActionFailed, "No available IPs in pool <#{pool}>"
284
+ fail ActionFailed, "No available IPs in pool <#{pool}>" # rubocop:disable Metrics/LineLength, SignalException
289
285
  end
290
286
  config[:floating_ip] = free_addrs[0]
291
287
  attach_ip(server, free_addrs[0])
@@ -336,7 +332,7 @@ module Kitchen
336
332
  pub, priv = parse_ips(pub, priv)
337
333
  pub[config[:public_ip_order].to_i] ||
338
334
  priv[config[:private_ip_order].to_i] ||
339
- fail(ActionFailed, 'Could not find an IP')
335
+ fail(ActionFailed, 'Could not find an IP') # rubocop:disable Metrics/LineLength, SignalException
340
336
  end
341
337
 
342
338
  def parse_ips(pub, priv)
@@ -372,29 +368,6 @@ module Kitchen
372
368
  Ohai::Config[:hints_path][0]
373
369
  end
374
370
 
375
- def setup_ssh(server, state)
376
- if config[:key_name]
377
- info "Using OpenStack keypair <#{config[:key_name]}>"
378
- end
379
- info "Using public SSH key <#{config[:public_key_path]}>"
380
- info "Using private SSH key <#{config[:private_key_path]}>"
381
- state[:ssh_key] = config[:private_key_path]
382
- do_ssh_setup(state, config, server) unless config[:key_name]
383
- end
384
-
385
- def do_ssh_setup(state, config, server)
386
- info "Setting up SSH access for key <#{config[:public_key_path]}>"
387
- ssh = Fog::SSH.new(state[:hostname],
388
- config[:username],
389
- password: config[:password] || server.password)
390
- pub_key = open(config[:public_key_path]).read
391
- ssh.run([
392
- %(mkdir .ssh),
393
- %(echo "#{pub_key}" >> ~/.ssh/authorized_keys),
394
- %(passwd -l #{config[:username]})
395
- ])
396
- end
397
-
398
371
  def disable_ssl_validation
399
372
  require 'excon'
400
373
  Excon.defaults[:ssl_verify_peer] = false
@@ -64,7 +64,7 @@ module Kitchen
64
64
  @logger.debug "Waiting for volume to be ready for #{creation_timeout} seconds" # rubocop:disable Metrics/LineLength
65
65
  vol_model.wait_for(creation_timeout) do
66
66
  sleep(1)
67
- fail('Failed to make volume') if status.downcase == 'error'
67
+ fail('Failed to make volume') if status.casecmp('error'.downcase).zero? # rubocop:disable Metrics/LineLength, SignalException
68
68
  ready?
69
69
  end
70
70
 
@@ -3,7 +3,7 @@
3
3
  # Author:: Jonathan Hartman (<j@p4nt5.com>)
4
4
  #
5
5
  # Copyright (C) 2013-2015, Jonathan Hartman
6
- # Copyright (C) 2015, Chef Software Inc
6
+ # Copyright (C) 2015-2016, Chef Software Inc
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
9
9
  # you may not use this file except in compliance with the License.
@@ -22,6 +22,6 @@ module Kitchen
22
22
  #
23
23
  # @author Jonathan Hartman <j@p4nt5.com>
24
24
  module Driver
25
- OPENSTACK_VERSION = '2.2.0'
25
+ OPENSTACK_VERSION = '3.0.0.pre.1'.freeze
26
26
  end
27
27
  end
@@ -70,7 +70,7 @@ describe Kitchen::Driver::Openstack do
70
70
  end
71
71
  end
72
72
 
73
- describe '#initialize'do
73
+ describe '#initialize' do
74
74
  context 'default options' do
75
75
  it 'uses the normal SSH status check' do
76
76
  expect(driver[:no_ssh_tcp_check]).to eq(false)
@@ -120,11 +120,6 @@ describe Kitchen::Driver::Openstack do
120
120
  end
121
121
  end
122
122
 
123
- it 'defaults to SSH with root user on port 22' do
124
- expect(driver[:username]).to eq('root')
125
- expect(driver[:port]).to eq('22')
126
- end
127
-
128
123
  nils = [
129
124
  :server_name,
130
125
  :openstack_tenant,
@@ -741,7 +736,7 @@ describe Kitchen::Driver::Openstack do
741
736
  let(:hostname) { 'ab.c' * 20 }
742
737
 
743
738
  it 'limits the generated name to 63 characters' do
744
- expect(driver.send(:default_name).length).to be <= (63)
739
+ expect(driver.send(:default_name).length).to be <= 63
745
740
  end
746
741
  end
747
742
 
@@ -799,7 +794,7 @@ describe Kitchen::Driver::Openstack do
799
794
 
800
795
  it 'limits the generated name to 63 characters' do
801
796
  expect(driver.send(:server_name_prefix, long_prefix).length)
802
- .to be <= (63)
797
+ .to be <= 63
803
798
  end
804
799
  end
805
800
 
@@ -1114,83 +1109,6 @@ describe Kitchen::Driver::Openstack do
1114
1109
  end
1115
1110
  end
1116
1111
 
1117
- describe '#setup_ssh' do
1118
- let(:config) { { public_key_path: '/pub_key' } }
1119
- let(:config) do
1120
- {
1121
- public_key_path: '/pub_key',
1122
- key_name: 'OpenStackKey'
1123
- }
1124
- end
1125
-
1126
- let(:server) { double(password: 'aloha') }
1127
- let(:state) { { hostname: 'host' } }
1128
- let(:read) { double(read: 'a_key') }
1129
- let(:ssh) { double(run: true) }
1130
-
1131
- before(:each) do
1132
- allow(driver).to receive(:open).with(config[:public_key_path])
1133
- .and_return(read)
1134
- end
1135
-
1136
- context 'sets the ssh_key state' do
1137
- before do
1138
- allow(driver).to receive(:bourne_shell?).and_return(false)
1139
- allow(driver).to receive(:do_ssh_setup).and_return(nil)
1140
- end
1141
-
1142
- it 'does not execute the ssh setup' do
1143
- expect(driver).not_to receive(:do_ssh_setup)
1144
- driver.send(:setup_ssh, server, state)
1145
- end
1146
- end
1147
- end
1148
-
1149
- describe '#do_ssh_setup' do
1150
- let(:config) { { public_key_path: '/pub_key' } }
1151
- let(:server) { double(password: 'aloha') }
1152
- let(:state) { { hostname: 'host' } }
1153
- let(:read) { double(read: 'a_key') }
1154
- let(:ssh) { double(run: true) }
1155
-
1156
- before(:each) do
1157
- allow(driver).to receive(:open).with(config[:public_key_path])
1158
- .and_return(read)
1159
- end
1160
-
1161
- context 'when executed in a non-bourne shell' do
1162
- before do
1163
- allow(driver).to receive(:bourne_shell?).and_return(false)
1164
- end
1165
-
1166
- it 'does not execute the ssh setup' do
1167
- expect(driver).not_to receive(:setup_ssh)
1168
- end
1169
- end
1170
-
1171
- it 'opens an SSH session to the server' do
1172
- expect(Fog::SSH).to receive(:new).with(state[:hostname],
1173
- 'root',
1174
- password: 'aloha').and_return(ssh)
1175
- expect(ssh).to receive(:run).with([
1176
- 'mkdir .ssh',
1177
- 'echo "a_key" >> ~/.ssh/authorized_keys',
1178
- 'passwd -l root'
1179
- ])
1180
- driver.send(:do_ssh_setup, state, config, server)
1181
- end
1182
-
1183
- context 'a configured SSH password' do
1184
- let(:config) { super().merge(password: '12345') }
1185
-
1186
- it 'uses the configured password' do
1187
- expect(Fog::SSH).to receive(:new)
1188
- .with(state[:hostname], 'root', password: '12345').and_return(ssh)
1189
- driver.send(:do_ssh_setup, state, config, server)
1190
- end
1191
- end
1192
- end
1193
-
1194
1112
  describe '#add_ohai_hint' do
1195
1113
  let(:state) { { hostname: 'host' } }
1196
1114
  let(:ssh) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-openstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 3.0.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Hartman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-16 00:00:00.000000000 Z
12
+ date: 2016-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-kitchen
@@ -105,16 +105,16 @@ dependencies:
105
105
  name: rubocop
106
106
  requirement: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: '0.36'
111
111
  type: :development
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: '0.36'
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: cane
120
120
  requirement: !ruby/object:Gem::Requirement
@@ -237,12 +237,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
237
237
  version: 2.0.0
238
238
  required_rubygems_version: !ruby/object:Gem::Requirement
239
239
  requirements:
240
- - - ">="
240
+ - - ">"
241
241
  - !ruby/object:Gem::Version
242
- version: '0'
242
+ version: 1.3.1
243
243
  requirements: []
244
244
  rubyforge_project:
245
- rubygems_version: 2.2.2
245
+ rubygems_version: 2.4.8
246
246
  signing_key:
247
247
  specification_version: 4
248
248
  summary: A Test Kitchen OpenStack Nova driver