vm_shepherd 1.11.2 → 1.11.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ea022dca3043409c217daf3acaffbcc0ee73205
|
4
|
+
data.tar.gz: 33265e1f41141d6bcf281f58d887369fb880484a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 074f1d4cdc3b3d965e2d8a0c4e5dd25a5d0c747a19787c044af44aa64517fab81166b03b7d8f7217801f55b369c4565e22ae03ac12956501f6334680d1c65737
|
7
|
+
data.tar.gz: c15a7975823d8532fd886488b04bcefed4129ef1b67b92cb8a665fa89447bc2c09a41836dea396e165db633fd513899e33f4a38246b1b928570369d884bc2c61
|
@@ -6,8 +6,8 @@ module VmShepherd
|
|
6
6
|
@vdc_name = vdc_name
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
|
9
|
+
def delete_catalog_and_vms(catalog, vapp_names, logger)
|
10
|
+
delete_vms_in_vapps(vapp_names, logger)
|
11
11
|
delete_catalog(catalog)
|
12
12
|
end
|
13
13
|
|
@@ -17,10 +17,10 @@ module VmShepherd
|
|
17
17
|
@vdc ||= @client.find_vdc_by_name(@vdc_name)
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def delete_vms_in_vapps(vapp_names, logger)
|
21
21
|
vapp_names.each do |vapp_name|
|
22
22
|
begin
|
23
|
-
|
23
|
+
delete_vms_in_vapp(vapp_name)
|
24
24
|
rescue VCloudSdk::ObjectNotFoundError => e
|
25
25
|
logger.debug "Could not delete vapp '#{vapp_name}': #{e.inspect}"
|
26
26
|
end
|
@@ -31,7 +31,7 @@ module VmShepherd
|
|
31
31
|
@client.delete_catalog_by_name(catalog) if @client.catalog_exists?(catalog)
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
34
|
+
def delete_vms_in_vapp(vapp_name)
|
35
35
|
vapp = vdc.find_vapp_by_name(vapp_name)
|
36
36
|
vapp.vms.map do |vm|
|
37
37
|
vm.independent_disks.map do |disk|
|
@@ -39,8 +39,6 @@ module VmShepherd
|
|
39
39
|
vdc.delete_disk_by_name(disk.name)
|
40
40
|
end
|
41
41
|
end
|
42
|
-
vapp.power_off
|
43
|
-
vapp.delete
|
44
42
|
end
|
45
43
|
end
|
46
44
|
end
|
@@ -35,7 +35,7 @@ module VmShepherd
|
|
35
35
|
|
36
36
|
def destroy(vapp_names, catalog)
|
37
37
|
VmShepherd::Vcloud::Destroyer.new(client: client, vdc_name: @vdc_name).
|
38
|
-
|
38
|
+
delete_catalog_and_vms(catalog, vapp_names, @logger)
|
39
39
|
end
|
40
40
|
|
41
41
|
def clean_environment(vapp_names, catalog)
|
data/lib/vm_shepherd/version.rb
CHANGED
@@ -28,14 +28,14 @@ module VmShepherd
|
|
28
28
|
allow(vm).to receive(:detach_disk)
|
29
29
|
end
|
30
30
|
|
31
|
-
describe '#
|
31
|
+
describe '#delete_catalog_and_vms' do
|
32
32
|
context 'when the catalog exists' do
|
33
33
|
before do
|
34
34
|
allow(client).to receive(:catalog_exists?).with('CATALOG_NAME').and_return(true)
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'deletes the catalog' do
|
38
|
-
destroyer.
|
38
|
+
destroyer.delete_catalog_and_vms('CATALOG_NAME', [], fake_logger)
|
39
39
|
|
40
40
|
expect(client).to have_received(:delete_catalog_by_name).with('CATALOG_NAME')
|
41
41
|
end
|
@@ -47,25 +47,18 @@ module VmShepherd
|
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'skips deleting the catalog' do
|
50
|
-
destroyer.
|
50
|
+
destroyer.delete_catalog_and_vms('CATALOG_NAME', [], fake_logger)
|
51
51
|
|
52
52
|
expect(client).not_to have_received(:delete_catalog_by_name).with('CATALOG_NAME')
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'detaches and deletes persistent disks' do
|
57
|
-
destroyer.
|
57
|
+
destroyer.delete_catalog_and_vms('CATALOG_NAME', ['VAPP_NAME'], fake_logger)
|
58
58
|
|
59
59
|
expect(vm).to have_received(:detach_disk).with(disk)
|
60
60
|
expect(vdc).to have_received(:delete_disk_by_name).with('DISK_NAME')
|
61
61
|
end
|
62
|
-
|
63
|
-
it 'powers off and deletes vapps' do
|
64
|
-
destroyer.delete_catalog_and_vapps('CATALOG_NAME', ['VAPP_NAME'], fake_logger)
|
65
|
-
|
66
|
-
expect(vapp).to have_received(:power_off)
|
67
|
-
expect(vapp).to have_received(:delete)
|
68
|
-
end
|
69
62
|
end
|
70
63
|
end
|
71
64
|
end
|
@@ -286,8 +286,6 @@ module VmShepherd
|
|
286
286
|
expect(vdc).to receive(:find_vapp_by_name).with(vapp_name).and_return(vapp)
|
287
287
|
expect(vm).to receive(:detach_disk).with(disk)
|
288
288
|
expect(vdc).to receive(:delete_disk_by_name).with('disk name')
|
289
|
-
expect(vapp).to receive(:power_off)
|
290
|
-
expect(vapp).to receive(:delete)
|
291
289
|
expect(client).to receive(:delete_catalog_by_name).with(vapp_catalog)
|
292
290
|
|
293
291
|
expect(VCloudSdk::Client).to receive(:new).with(
|
@@ -338,8 +336,6 @@ module VmShepherd
|
|
338
336
|
expect(vdc).to receive(:find_vapp_by_name).with(vapp_name).and_return(vapp)
|
339
337
|
expect(vm).to receive(:detach_disk).with(disk)
|
340
338
|
expect(vdc).to receive(:delete_disk_by_name).with('disk name')
|
341
|
-
expect(vapp).to receive(:power_off)
|
342
|
-
expect(vapp).to receive(:delete)
|
343
339
|
expect(client).not_to receive(:delete_catalog_by_name).with(vapp_catalog)
|
344
340
|
|
345
341
|
expect(VCloudSdk::Client).to receive(:new).with(
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vm_shepherd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ops Manager Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-v1
|