vm_shepherd 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vm_shepherd/version.rb +1 -1
- data/lib/vm_shepherd/vsphere_manager.rb +2 -2
- data/spec/vm_shepherd/vsphere_manager_spec.rb +13 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e40010121984be566b3f88a3e7d12984223d10df
|
4
|
+
data.tar.gz: 85e3ec192349a2a70de3612dcde0ec982edec9f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0afc08340253f1d54b01762c960f1e879ca367e6ecb6fa0d47bd19e9cef67566f820131af993db862c082b03fa51333369a65d5735cbecce62fddb106a2ad22
|
7
|
+
data.tar.gz: bea513f347e77b7fee6cf95404a9f4a17e7f20acf881bd40a785c4c3163f43a19a4e563e4b169b01cc6f8a5c166da882cd37594efdf303e66b0418871ae7aa33
|
data/lib/vm_shepherd/version.rb
CHANGED
@@ -57,8 +57,8 @@ module VmShepherd
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def destroy(ip_address, resource_pool_name)
|
60
|
-
vms = connection.serviceContent.searchIndex.FindAllByIp(ip: ip_address, vmSearch: true)
|
61
|
-
|
60
|
+
vms = connection.serviceContent.searchIndex.FindAllByIp(ip: ip_address, vmSearch: true)
|
61
|
+
vms = vms.select { |vm| resource_pool_name == vm.resourcePool.name } if resource_pool_name
|
62
62
|
vms.each do |vm|
|
63
63
|
power_off_vm(vm)
|
64
64
|
destroy_vm(vm)
|
@@ -42,6 +42,19 @@ module VmShepherd
|
|
42
42
|
vsphere_manager.destroy(ip_address, 'second_resource_pool')
|
43
43
|
end
|
44
44
|
|
45
|
+
it 'destroys the VM that matches the given ip address only when resource pool nil' do
|
46
|
+
expect(vsphere_manager).to receive(:power_off_vm).with(vm1)
|
47
|
+
expect(vsphere_manager).to receive(:destroy_vm).with(vm1)
|
48
|
+
|
49
|
+
expect(vsphere_manager).to receive(:power_off_vm).with(vm2)
|
50
|
+
expect(vsphere_manager).to receive(:destroy_vm).with(vm2)
|
51
|
+
|
52
|
+
expect(vsphere_manager).to receive(:power_off_vm).with(vm3)
|
53
|
+
expect(vsphere_manager).to receive(:destroy_vm).with(vm3)
|
54
|
+
|
55
|
+
vsphere_manager.destroy(ip_address, nil)
|
56
|
+
end
|
57
|
+
|
45
58
|
context 'when there are no vms with that IP address' do
|
46
59
|
let(:vms) { [] }
|
47
60
|
|