openstack_taster 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openstack_taster.rb +25 -7
- data/tests/inspec.yml +1 -1
- 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: 05a553071d6d302a7fe9e703b5ac460b017ed0d8
|
4
|
+
data.tar.gz: a82133b64313108f02b673512bbc359fe0e1bdce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41bd0949cdca2c50661844235fbd9a074e27be8dc1a24f6ef8176c76db3f3a3f237ebdaac763b15af70513636d78cb9f1bc5172535f34377074e46196e82f3ed
|
7
|
+
data.tar.gz: f6ae5f21e1eebc08bf489f555c858d5bb60139d89e71cbeff99d2f2e61c996b055bf0fc95c43ad23a286697c3b55ae62d6a40f9ad611426711f122d96e30f668
|
data/lib/openstack_taster.rb
CHANGED
@@ -279,37 +279,37 @@ class OpenStackTaster
|
|
279
279
|
if volume_attach?(instance, volume)
|
280
280
|
vdev = @volume_service.volumes.find_by_id(volume.id).attachments.first['device']
|
281
281
|
mkfs_command = [
|
282
|
-
["sudo parted --script #{vdev} mklabel gpt mkpart primary 1 100%",
|
283
|
-
["sudo mkfs.#{VOLUME_FILESYSTEM} -Fq #{vdev}1",
|
282
|
+
["sudo parted --script #{vdev} mklabel gpt mkpart primary 1 100%", /^$/],
|
283
|
+
["sudo mkfs.#{VOLUME_FILESYSTEM} -Fq #{vdev}1", /(^$)|(done\n)?/]
|
284
284
|
]
|
285
285
|
with_ssh(instance, username) do |ssh|
|
286
286
|
mkfs_command.each do |command, expected|
|
287
287
|
result = ssh.exec!(command)
|
288
|
-
next unless result
|
288
|
+
next unless result !~ expected
|
289
289
|
error_log(
|
290
290
|
instance.logger,
|
291
291
|
'error',
|
292
292
|
"Failure while running '#{command}':\n\texpected '#{expected}'\n\tgot '#{result}'",
|
293
293
|
true
|
294
294
|
)
|
295
|
+
_detach = volume_detach?(instance, volume)
|
296
|
+
volume_delete(instance, volume)
|
295
297
|
return false
|
296
298
|
end
|
297
299
|
end
|
298
300
|
mount = volume_mount_unmount?(instance, username, volume)
|
299
301
|
detach = volume_detach?(instance, volume)
|
302
|
+
volume_delete(instance, volume)
|
300
303
|
else
|
301
304
|
error_log(instance.logger, 'error', "Volume '#{volume.id}' failed to attach.", true)
|
305
|
+
volume_delete(instance, volume)
|
302
306
|
return false
|
303
307
|
end
|
304
308
|
|
305
309
|
if mount && detach
|
306
|
-
error_log(instance.logger, 'info', "Deleting volume #{volume.id}.", true)
|
307
|
-
volume.destroy if volume.ready?
|
308
310
|
error_log(instance.logger, 'info', "\nVolume testing passed!.", true)
|
309
311
|
true
|
310
312
|
else
|
311
|
-
error_log(instance.logger, 'info', "Deleting volume #{volume.id}.", true)
|
312
|
-
volume.destroy if volume.ready?
|
313
313
|
error_log(
|
314
314
|
instance.logger,
|
315
315
|
'error',
|
@@ -468,4 +468,22 @@ class OpenStackTaster
|
|
468
468
|
error_log(instance.logger, 'error', e.message)
|
469
469
|
false
|
470
470
|
end
|
471
|
+
|
472
|
+
# Delete volume
|
473
|
+
# @param instance [Fog::Compute::OpenStack::Server] the instance from which to detach
|
474
|
+
# @param volume [Fog::Volume::OpenStack::Volume] the volume to detach
|
475
|
+
def volume_delete(instance, volume)
|
476
|
+
error_log(instance.logger, 'info', "Deleting volume #{volume.name}.", true)
|
477
|
+
loop do
|
478
|
+
volume.reload
|
479
|
+
sleep 2
|
480
|
+
break if volume.ready?
|
481
|
+
error_log(instance.logger, 'info', "volume #{volume.name} not ready, waiting...", true)
|
482
|
+
end
|
483
|
+
volume.destroy
|
484
|
+
error_log(instance.logger, 'info', "Deleted volume #{volume.name}.", true)
|
485
|
+
rescue Excon::Error => e
|
486
|
+
puts 'Failed to delete. check log for details.'
|
487
|
+
error_log(instance.logger, 'error', e.message)
|
488
|
+
end
|
471
489
|
end
|
data/tests/inspec.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openstack_taster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OSU Open Source Lab
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inspec
|