kitchen-openstack 3.5.0 → 3.5.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 +4 -4
- data/.travis.yml +4 -3
- data/CHANGELOG.md +14 -1
- data/Gemfile +1 -1
- data/Rakefile +8 -7
- data/kitchen-openstack.gemspec +24 -24
- data/lib/kitchen/driver/openstack.rb +58 -60
- data/lib/kitchen/driver/openstack/volume.rb +9 -9
- data/lib/kitchen/driver/openstack_version.rb +1 -1
- data/spec/kitchen/driver/openstack/volume_spec.rb +37 -37
- data/spec/kitchen/driver/openstack_spec.rb +508 -508
- data/spec/spec_helper.rb +6 -6
- metadata +10 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7e7db233a71d287401a7403affdb1d4eee850bf9
|
|
4
|
+
data.tar.gz: d2fb24f0f65476236165f7bbd1dd35feefe404ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ea06e965c4e275d377977ec323a1134957f663192dbf0cfb1caba4733f0f38e0970b070bdfd5fe05858036514f221c4aa1f412847d1fbf47dd81976067ca61de
|
|
7
|
+
data.tar.gz: 84154e6004899ccc99eb8433f7596bcca52b398a046d06c4338275aa03418d7b11aaf6733ff571332fed7a766cf8b2f25b0176c685b2b3a0978ff2bee69e65a4
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
## [v3.5.
|
|
3
|
+
## [v3.5.1](https://github.com/test-kitchen/kitchen-openstack/tree/v3.5.1)
|
|
4
4
|
|
|
5
|
+
[Full Changelog](https://github.com/test-kitchen/kitchen-openstack/compare/v3.5.0...v3.5.1)
|
|
6
|
+
|
|
7
|
+
**Closed issues:**
|
|
8
|
+
|
|
9
|
+
- block\_device\_mapping crashes on nodename nor servname provided [\#176](https://github.com/test-kitchen/kitchen-openstack/issues/176)
|
|
10
|
+
- Same floating IP to different server [\#175](https://github.com/test-kitchen/kitchen-openstack/issues/175)
|
|
11
|
+
- Cannot create windows machines [\#172](https://github.com/test-kitchen/kitchen-openstack/issues/172)
|
|
12
|
+
|
|
13
|
+
**Merged pull requests:**
|
|
14
|
+
|
|
15
|
+
- Switch from fog to fog-openstack to slim deps and speed runtime [\#174](https://github.com/test-kitchen/kitchen-openstack/pull/174) ([tas50](https://github.com/tas50))
|
|
16
|
+
|
|
17
|
+
## [v3.5.0](https://github.com/test-kitchen/kitchen-openstack/tree/v3.5.0) (2017-04-12)
|
|
5
18
|
[Full Changelog](https://github.com/test-kitchen/kitchen-openstack/compare/v3.4.0...v3.5.0)
|
|
6
19
|
|
|
7
20
|
**Merged pull requests:**
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
# Encoding: UTF-8
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
-
require
|
|
6
|
-
require
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "bundler/gem_tasks"
|
|
5
|
+
require "chefstyle"
|
|
6
|
+
require "rubocop/rake_task"
|
|
7
|
+
require "rspec/core/rake_task"
|
|
7
8
|
|
|
8
9
|
RuboCop::RakeTask.new
|
|
9
10
|
|
|
10
|
-
desc
|
|
11
|
+
desc "Display LOC stats"
|
|
11
12
|
task :loc do
|
|
12
13
|
puts "\n## LOC Stats"
|
|
13
|
-
sh
|
|
14
|
+
sh "countloc -r lib/kitchen"
|
|
14
15
|
end
|
|
15
16
|
|
|
16
17
|
RSpec::Core::RakeTask.new(:spec)
|
|
17
18
|
|
|
18
|
-
task default: %i
|
|
19
|
+
task default: %i{rubocop loc spec}
|
data/kitchen-openstack.gemspec
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
# Encoding: UTF-8
|
|
2
2
|
|
|
3
|
-
lib = File.expand_path(
|
|
3
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
-
require
|
|
5
|
+
require "kitchen/driver/openstack_version"
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
|
-
spec.name =
|
|
8
|
+
spec.name = "kitchen-openstack"
|
|
9
9
|
spec.version = Kitchen::Driver::OPENSTACK_VERSION
|
|
10
|
-
spec.authors = [
|
|
11
|
-
spec.email = [
|
|
12
|
-
spec.description =
|
|
10
|
+
spec.authors = ["Jonathan Hartman", "JJ Asghar"]
|
|
11
|
+
spec.email = ["j@p4nt5.com", "jj@chef.io"]
|
|
12
|
+
spec.description = "A Test Kitchen OpenStack Nova driver"
|
|
13
13
|
spec.summary = spec.description
|
|
14
|
-
spec.homepage =
|
|
15
|
-
spec.license =
|
|
14
|
+
spec.homepage = "https://github.com/test-kitchen/kitchen-openstack"
|
|
15
|
+
spec.license = "Apache"
|
|
16
16
|
|
|
17
17
|
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
20
|
-
spec.require_paths = [
|
|
20
|
+
spec.require_paths = ["lib"]
|
|
21
21
|
|
|
22
|
-
spec.required_ruby_version =
|
|
22
|
+
spec.required_ruby_version = ">= 2.0.0"
|
|
23
23
|
|
|
24
|
-
spec.add_dependency
|
|
25
|
-
spec.add_dependency
|
|
26
|
-
spec.add_dependency
|
|
27
|
-
spec.add_dependency
|
|
24
|
+
spec.add_dependency "test-kitchen", "~> 1.4", ">= 1.4.1"
|
|
25
|
+
spec.add_dependency "fog-openstack", "~> 0.1"
|
|
26
|
+
spec.add_dependency "unf"
|
|
27
|
+
spec.add_dependency "ohai"
|
|
28
28
|
|
|
29
|
-
spec.add_development_dependency
|
|
30
|
-
spec.add_development_dependency
|
|
31
|
-
spec.add_development_dependency
|
|
32
|
-
spec.add_development_dependency
|
|
33
|
-
spec.add_development_dependency
|
|
34
|
-
spec.add_development_dependency
|
|
35
|
-
spec.add_development_dependency
|
|
36
|
-
spec.add_development_dependency
|
|
37
|
-
spec.add_development_dependency
|
|
38
|
-
spec.add_development_dependency
|
|
29
|
+
spec.add_development_dependency "bundler"
|
|
30
|
+
spec.add_development_dependency "rake"
|
|
31
|
+
spec.add_development_dependency "chefstyle"
|
|
32
|
+
spec.add_development_dependency "cane"
|
|
33
|
+
spec.add_development_dependency "countloc"
|
|
34
|
+
spec.add_development_dependency "rspec"
|
|
35
|
+
spec.add_development_dependency "simplecov"
|
|
36
|
+
spec.add_development_dependency "simplecov-console"
|
|
37
|
+
spec.add_development_dependency "coveralls"
|
|
38
|
+
spec.add_development_dependency "github_changelog_generator"
|
|
39
39
|
end
|
|
@@ -19,16 +19,15 @@
|
|
|
19
19
|
# See the License for the specific language governing permissions and
|
|
20
20
|
# limitations under the License.
|
|
21
21
|
|
|
22
|
-
require
|
|
23
|
-
require
|
|
24
|
-
require
|
|
25
|
-
require_relative
|
|
26
|
-
require_relative
|
|
22
|
+
require "kitchen"
|
|
23
|
+
require "fog/openstack"
|
|
24
|
+
require "ohai"
|
|
25
|
+
require_relative "openstack_version"
|
|
26
|
+
require_relative "openstack/volume"
|
|
27
27
|
|
|
28
28
|
module Kitchen
|
|
29
29
|
module Driver
|
|
30
30
|
# This takes from the Base Class and creates the OpenStack driver.
|
|
31
|
-
# rubocop: disable Metrics/ClassLength
|
|
32
31
|
class Openstack < Kitchen::Driver::Base
|
|
33
32
|
@@ip_pool_lock = Mutex.new
|
|
34
33
|
|
|
@@ -38,7 +37,7 @@ module Kitchen
|
|
|
38
37
|
default_config :server_name, nil
|
|
39
38
|
default_config :server_name_prefix, nil
|
|
40
39
|
default_config :key_name, nil
|
|
41
|
-
default_config :port,
|
|
40
|
+
default_config :port, "22"
|
|
42
41
|
default_config :use_ipv6, false
|
|
43
42
|
default_config :openstack_tenant, nil
|
|
44
43
|
default_config :openstack_region, nil
|
|
@@ -82,10 +81,10 @@ module Kitchen
|
|
|
82
81
|
disable_ssl_validation if config[:disable_ssl_validation]
|
|
83
82
|
server = create_server
|
|
84
83
|
state[:server_id] = server.id
|
|
85
|
-
info "OpenStack instance with ID of <#{state[:server_id]}> is ready."
|
|
84
|
+
info "OpenStack instance with ID of <#{state[:server_id]}> is ready."
|
|
86
85
|
|
|
87
86
|
# this is due to the glance_caching issues. Annoying yes, but necessary.
|
|
88
|
-
debug "Waiting for VM to be in ACTIVE state for a max time of:#{config[:glance_cache_wait_timeout]} seconds"
|
|
87
|
+
debug "Waiting for VM to be in ACTIVE state for a max time of:#{config[:glance_cache_wait_timeout]} seconds"
|
|
89
88
|
server.wait_for(config[:glance_cache_wait_timeout]) do
|
|
90
89
|
sleep(1)
|
|
91
90
|
ready?
|
|
@@ -111,14 +110,14 @@ module Kitchen
|
|
|
111
110
|
|
|
112
111
|
unless server.nil?
|
|
113
112
|
if config[:floating_ip_pool] && config[:allocate_floating_ip]
|
|
114
|
-
info
|
|
113
|
+
info "Retrieve the floating IP"
|
|
115
114
|
pub, priv = get_public_private_ips(server)
|
|
116
115
|
pub, = parse_ips(pub, priv)
|
|
117
116
|
pub_ip = pub[config[:public_ip_order].to_i] || nil
|
|
118
117
|
if pub_ip
|
|
119
118
|
info "Retrieve the ID of floating IP <#{pub_ip}>"
|
|
120
|
-
floating_ip_id = network.list_floating_ips(floating_ip_address: pub_ip)
|
|
121
|
-
.body[
|
|
119
|
+
floating_ip_id = network.list_floating_ips(floating_ip_address: pub_ip)
|
|
120
|
+
.body["floatingips"][0]["id"]
|
|
122
121
|
network.delete_floating_ip(floating_ip_id)
|
|
123
122
|
info "OpenStack Floating IP <#{pub_ip}> released."
|
|
124
123
|
end
|
|
@@ -134,27 +133,27 @@ module Kitchen
|
|
|
134
133
|
|
|
135
134
|
def openstack_server
|
|
136
135
|
server_def = {
|
|
137
|
-
provider:
|
|
138
|
-
connection_options: {}
|
|
136
|
+
provider: "OpenStack",
|
|
137
|
+
connection_options: {},
|
|
139
138
|
}
|
|
140
139
|
required_server_settings.each { |s| server_def[s] = config[s] }
|
|
141
|
-
optional_server_settings.each { |s| server_def[s] = config[s] if config[s] }
|
|
142
|
-
connection_options.each { |s| server_def[:connection_options][s] = config[s] if config[s] }
|
|
140
|
+
optional_server_settings.each { |s| server_def[s] = config[s] if config[s] }
|
|
141
|
+
connection_options.each { |s| server_def[:connection_options][s] = config[s] if config[s] }
|
|
143
142
|
server_def
|
|
144
143
|
end
|
|
145
144
|
|
|
146
145
|
def required_server_settings
|
|
147
|
-
%i
|
|
146
|
+
%i{openstack_username openstack_api_key openstack_auth_url}
|
|
148
147
|
end
|
|
149
148
|
|
|
150
149
|
def optional_server_settings
|
|
151
150
|
Fog::Compute::OpenStack.recognized.select do |k|
|
|
152
|
-
k.to_s.start_with?(
|
|
151
|
+
k.to_s.start_with?("openstack")
|
|
153
152
|
end - required_server_settings
|
|
154
153
|
end
|
|
155
154
|
|
|
156
155
|
def connection_options
|
|
157
|
-
%i
|
|
156
|
+
%i{read_timeout write_timeout connect_timeout}
|
|
158
157
|
end
|
|
159
158
|
|
|
160
159
|
def network
|
|
@@ -175,16 +174,16 @@ module Kitchen
|
|
|
175
174
|
|
|
176
175
|
def create_server
|
|
177
176
|
server_def = init_configuration
|
|
178
|
-
fail(ActionFailed,
|
|
177
|
+
fail(ActionFailed, "Cannot specify both network_ref and network_id") if config[:network_id] && config[:network_ref] # rubocop:disable SignalException
|
|
179
178
|
if config[:network_id]
|
|
180
179
|
networks = [].concat([config[:network_id]])
|
|
181
180
|
server_def[:nics] = networks.flatten.map do |net_id|
|
|
182
|
-
{
|
|
181
|
+
{ "net_id" => net_id }
|
|
183
182
|
end
|
|
184
183
|
elsif config[:network_ref]
|
|
185
184
|
networks = [].concat([config[:network_ref]])
|
|
186
185
|
server_def[:nics] = networks.flatten.map do |net|
|
|
187
|
-
{
|
|
186
|
+
{ "net_id" => find_network(net).id }
|
|
188
187
|
end
|
|
189
188
|
end
|
|
190
189
|
|
|
@@ -192,13 +191,13 @@ module Kitchen
|
|
|
192
191
|
server_def[:block_device_mapping] = get_bdm(config)
|
|
193
192
|
end
|
|
194
193
|
|
|
195
|
-
%i
|
|
194
|
+
%i{
|
|
196
195
|
security_groups
|
|
197
196
|
key_name
|
|
198
197
|
user_data
|
|
199
198
|
config_drive
|
|
200
199
|
metadata
|
|
201
|
-
|
|
200
|
+
}.each do |c|
|
|
202
201
|
server_def[c] = optional_config(c) if config[c]
|
|
203
202
|
end
|
|
204
203
|
|
|
@@ -209,13 +208,13 @@ module Kitchen
|
|
|
209
208
|
end
|
|
210
209
|
|
|
211
210
|
def init_configuration
|
|
212
|
-
fail(ActionFailed,
|
|
213
|
-
fail(ActionFailed,
|
|
211
|
+
fail(ActionFailed, "Cannot specify both image_ref and image_id") if config[:image_id] && config[:image_ref] # rubocop:disable SignalException
|
|
212
|
+
fail(ActionFailed, "Cannot specify both flavor_ref and flavor_id") if config[:flavor_id] && config[:flavor_ref] # rubocop:disable SignalException
|
|
214
213
|
{
|
|
215
214
|
name: config[:server_name],
|
|
216
215
|
image_ref: config[:image_id] || find_image(config[:image_ref]).id,
|
|
217
216
|
flavor_ref: config[:flavor_id] || find_flavor(config[:flavor_ref]).id,
|
|
218
|
-
availability_zone: config[:availability_zone]
|
|
217
|
+
availability_zone: config[:availability_zone],
|
|
219
218
|
}
|
|
220
219
|
end
|
|
221
220
|
|
|
@@ -232,21 +231,21 @@ module Kitchen
|
|
|
232
231
|
|
|
233
232
|
def find_image(image_ref)
|
|
234
233
|
image = find_matching(compute.images, image_ref)
|
|
235
|
-
fail(ActionFailed,
|
|
234
|
+
fail(ActionFailed, "Image not found") unless image # rubocop:disable SignalException
|
|
236
235
|
debug "Selected image: #{image.id} #{image.name}"
|
|
237
236
|
image
|
|
238
237
|
end
|
|
239
238
|
|
|
240
239
|
def find_flavor(flavor_ref)
|
|
241
240
|
flavor = find_matching(compute.flavors, flavor_ref)
|
|
242
|
-
fail(ActionFailed,
|
|
241
|
+
fail(ActionFailed, "Flavor not found") unless flavor # rubocop:disable SignalException
|
|
243
242
|
debug "Selected flavor: #{flavor.id} #{flavor.name}"
|
|
244
243
|
flavor
|
|
245
244
|
end
|
|
246
245
|
|
|
247
246
|
def find_network(network_ref)
|
|
248
247
|
net = find_matching(network.networks.all, network_ref)
|
|
249
|
-
fail(ActionFailed,
|
|
248
|
+
fail(ActionFailed, "Network not found") unless net # rubocop:disable SignalException
|
|
250
249
|
debug "Selected net: #{net.id} #{net.name}"
|
|
251
250
|
net
|
|
252
251
|
end
|
|
@@ -261,11 +260,11 @@ module Kitchen
|
|
|
261
260
|
# Total: 63
|
|
262
261
|
def default_name
|
|
263
262
|
[
|
|
264
|
-
instance.name.gsub(/\W/,
|
|
265
|
-
(Etc.getlogin ||
|
|
266
|
-
Socket.gethostname.gsub(/\W/,
|
|
267
|
-
Array.new(7) { rand(36).to_s(36) }.join
|
|
268
|
-
].join(
|
|
263
|
+
instance.name.gsub(/\W/, "")[0..14],
|
|
264
|
+
(Etc.getlogin || "nologin").gsub(/\W/, "")[0..14],
|
|
265
|
+
Socket.gethostname.gsub(/\W/, "")[0..22],
|
|
266
|
+
Array.new(7) { rand(36).to_s(36) }.join,
|
|
267
|
+
].join("-")
|
|
269
268
|
end
|
|
270
269
|
|
|
271
270
|
def server_name_prefix(server_name_prefix)
|
|
@@ -279,18 +278,18 @@ module Kitchen
|
|
|
279
278
|
# Max: 63
|
|
280
279
|
#
|
|
281
280
|
if server_name_prefix.length > 54
|
|
282
|
-
warn
|
|
281
|
+
warn "Server name prefix too long, truncated to 54 characters"
|
|
283
282
|
server_name_prefix = server_name_prefix[0..53]
|
|
284
283
|
end
|
|
285
284
|
|
|
286
|
-
server_name_prefix.gsub!(/\W/,
|
|
285
|
+
server_name_prefix.gsub!(/\W/, "")
|
|
287
286
|
|
|
288
287
|
if server_name_prefix.empty?
|
|
289
|
-
warn
|
|
288
|
+
warn "Server name prefix empty or invalid; using fully generated name"
|
|
290
289
|
default_name
|
|
291
290
|
else
|
|
292
|
-
random_suffix = (
|
|
293
|
-
server_name_prefix +
|
|
291
|
+
random_suffix = ("a".."z").to_a.sample(8).join
|
|
292
|
+
server_name_prefix + "-" + random_suffix
|
|
294
293
|
end
|
|
295
294
|
end
|
|
296
295
|
|
|
@@ -299,9 +298,9 @@ module Kitchen
|
|
|
299
298
|
info "Attaching floating IP from <#{pool}> pool"
|
|
300
299
|
if config[:allocate_floating_ip]
|
|
301
300
|
network_id = network.list_networks(name: pool)
|
|
302
|
-
.body[
|
|
301
|
+
.body["networks"][0]["id"]
|
|
303
302
|
resp = network.create_floating_ip(network_id)
|
|
304
|
-
ip = resp.body[
|
|
303
|
+
ip = resp.body["floatingip"]["floating_ip_address"]
|
|
305
304
|
info "Created floating IP <#{ip}> from <#{pool}> pool"
|
|
306
305
|
config[:floating_ip] = ip
|
|
307
306
|
else
|
|
@@ -309,7 +308,7 @@ module Kitchen
|
|
|
309
308
|
i.ip if i.fixed_ip.nil? && i.instance_id.nil? && i.pool == pool
|
|
310
309
|
end.compact
|
|
311
310
|
if free_addrs.empty?
|
|
312
|
-
fail ActionFailed, "No available IPs in pool <#{pool}>" # rubocop:disable
|
|
311
|
+
fail ActionFailed, "No available IPs in pool <#{pool}>" # rubocop:disable SignalException
|
|
313
312
|
end
|
|
314
313
|
config[:floating_ip] = free_addrs[0]
|
|
315
314
|
end
|
|
@@ -329,13 +328,12 @@ module Kitchen
|
|
|
329
328
|
rescue Fog::Compute::OpenStack::NotFound, Excon::Errors::Forbidden
|
|
330
329
|
# See Fog issue: https://github.com/fog/fog/issues/2160
|
|
331
330
|
addrs = server.addresses
|
|
332
|
-
addrs[
|
|
333
|
-
addrs[
|
|
331
|
+
addrs["public"] && pub = addrs["public"].map { |i| i["addr"] }
|
|
332
|
+
addrs["private"] && priv = addrs["private"].map { |i| i["addr"] }
|
|
334
333
|
end
|
|
335
334
|
[pub, priv]
|
|
336
335
|
end
|
|
337
336
|
|
|
338
|
-
# rubocop:disable AbcSize
|
|
339
337
|
def get_ip(server)
|
|
340
338
|
if config[:floating_ip]
|
|
341
339
|
debug "Using floating ip: #{config[:floating_ip]}"
|
|
@@ -343,19 +341,19 @@ module Kitchen
|
|
|
343
341
|
end
|
|
344
342
|
|
|
345
343
|
# make sure we have the latest info
|
|
346
|
-
info
|
|
344
|
+
info "Waiting for network information to be available..."
|
|
347
345
|
begin
|
|
348
346
|
w = server.wait_for { !addresses.empty? }
|
|
349
347
|
debug "Waited #{w[:duration]} seconds for network information."
|
|
350
348
|
rescue Fog::Errors::TimeoutError
|
|
351
|
-
raise ActionFailed,
|
|
349
|
+
raise ActionFailed, "Could not get network information (timed out)"
|
|
352
350
|
end
|
|
353
351
|
|
|
354
352
|
# should also work for private networks
|
|
355
353
|
if config[:openstack_network_name]
|
|
356
354
|
debug "Using configured net: #{config[:openstack_network_name]}"
|
|
357
355
|
return filter_ips(server.addresses[config[:openstack_network_name]])
|
|
358
|
-
.first[
|
|
356
|
+
.first["addr"]
|
|
359
357
|
end
|
|
360
358
|
|
|
361
359
|
pub, priv = get_public_private_ips(server)
|
|
@@ -363,14 +361,14 @@ module Kitchen
|
|
|
363
361
|
pub, priv = parse_ips(pub, priv)
|
|
364
362
|
pub[config[:public_ip_order].to_i] ||
|
|
365
363
|
priv[config[:private_ip_order].to_i] ||
|
|
366
|
-
fail(ActionFailed,
|
|
364
|
+
fail(ActionFailed, "Could not find an IP") # rubocop:disable SignalException
|
|
367
365
|
end
|
|
368
366
|
|
|
369
367
|
def filter_ips(addresses)
|
|
370
368
|
if config[:use_ipv6]
|
|
371
|
-
addresses.select { |i| IPAddr.new(i[
|
|
369
|
+
addresses.select { |i| IPAddr.new(i["addr"]).ipv6? }
|
|
372
370
|
else
|
|
373
|
-
addresses.select { |i| IPAddr.new(i[
|
|
371
|
+
addresses.select { |i| IPAddr.new(i["addr"]).ipv4? }
|
|
374
372
|
end
|
|
375
373
|
end
|
|
376
374
|
|
|
@@ -387,14 +385,14 @@ module Kitchen
|
|
|
387
385
|
|
|
388
386
|
def add_ohai_hint(state)
|
|
389
387
|
if bourne_shell?
|
|
390
|
-
info
|
|
388
|
+
info "Adding OpenStack hint for ohai"
|
|
391
389
|
mkdir_cmd = "sudo mkdir -p #{hints_path}"
|
|
392
390
|
touch_cmd = "sudo bash -c 'echo {} > #{hints_path}/openstack.json'"
|
|
393
391
|
instance.transport.connection(state).execute(
|
|
394
392
|
"#{mkdir_cmd} && #{touch_cmd}"
|
|
395
393
|
)
|
|
396
394
|
elsif windows_os?
|
|
397
|
-
info
|
|
395
|
+
info "Adding OpenStack hint for ohai"
|
|
398
396
|
touch_cmd = "New-Item #{hints_path}\\openstack.json"
|
|
399
397
|
touch_cmd_args = "-Value '{}' -Force -Type file"
|
|
400
398
|
instance.transport.connection(state).execute(
|
|
@@ -408,19 +406,19 @@ module Kitchen
|
|
|
408
406
|
end
|
|
409
407
|
|
|
410
408
|
def disable_ssl_validation
|
|
411
|
-
require
|
|
409
|
+
require "excon"
|
|
412
410
|
Excon.defaults[:ssl_verify_peer] = false
|
|
413
411
|
end
|
|
414
412
|
|
|
415
413
|
def wait_for_server(state)
|
|
416
414
|
if config[:server_wait]
|
|
417
|
-
info "Sleeping for #{config[:server_wait]} seconds to let your server start up..."
|
|
415
|
+
info "Sleeping for #{config[:server_wait]} seconds to let your server start up..."
|
|
418
416
|
countdown(config[:server_wait])
|
|
419
417
|
end
|
|
420
|
-
info
|
|
418
|
+
info "Waiting for server to be ready..."
|
|
421
419
|
instance.transport.connection(state).wait_until_ready
|
|
422
420
|
rescue
|
|
423
|
-
error "Server #{state[:hostname]} (#{state[:server_id]}) not reachable. Destroying server..."
|
|
421
|
+
error "Server #{state[:hostname]} (#{state[:server_id]}) not reachable. Destroying server..."
|
|
424
422
|
destroy(state)
|
|
425
423
|
raise
|
|
426
424
|
end
|
|
@@ -428,14 +426,14 @@ module Kitchen
|
|
|
428
426
|
def countdown(seconds)
|
|
429
427
|
date1 = Time.now + seconds
|
|
430
428
|
while Time.now < date1
|
|
431
|
-
Kernel.print
|
|
429
|
+
Kernel.print "."
|
|
432
430
|
sleep 10
|
|
433
431
|
end
|
|
434
432
|
end
|
|
435
433
|
|
|
436
434
|
def find_matching(collection, name)
|
|
437
435
|
name = name.to_s
|
|
438
|
-
if name.start_with?(
|
|
436
|
+
if name.start_with?("/") && name.end_with?("/")
|
|
439
437
|
regex = Regexp.new(name[1...-1])
|
|
440
438
|
# check for regex name match
|
|
441
439
|
collection.each { |single| return single if regex =~ single.name }
|