mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Merge pull request #272 from mattkirby/pooler_40
(POOLER-40) Do not return folders with get_pool_vms
This commit is contained in:
commit
afc5a33d8f
2 changed files with 25 additions and 1 deletions
|
|
@ -51,7 +51,7 @@ module Vmpooler
|
||||||
return vms if folder_object.nil?
|
return vms if folder_object.nil?
|
||||||
|
|
||||||
folder_object.childEntity.each do |vm|
|
folder_object.childEntity.each do |vm|
|
||||||
vms << { 'name' => vm.name }
|
vms << { 'name' => vm.name } if vm.is_a? RbVmomi::VIM::VirtualMachine
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
vms
|
vms
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,30 @@ EOT
|
||||||
expect(result).to eq(expected_vm_list)
|
expect(result).to eq(expected_vm_list)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'given a pool folder with a folder and vms' do
|
||||||
|
let(:expected_vm_list) {[
|
||||||
|
{ 'name' => 'vm1'},
|
||||||
|
{ 'name' => 'vm2'},
|
||||||
|
{ 'name' => 'vm3'}
|
||||||
|
]}
|
||||||
|
let(:folder_object2) { mock_RbVmomi_VIM_Folder({ :name => 'pool2'}) }
|
||||||
|
before(:each) do
|
||||||
|
expected_vm_list.each do |vm_hash|
|
||||||
|
mock_vm = mock_RbVmomi_VIM_VirtualMachine({ :name => vm_hash['name'] })
|
||||||
|
# Add the mocked VM to the folder
|
||||||
|
folder_object.childEntity << mock_vm
|
||||||
|
end
|
||||||
|
folder_object.childEntity << folder_object2
|
||||||
|
expect(subject).to receive(:find_folder).with(pool_config['folder'],connection,datacenter_name).and_return(folder_object)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should return the vms without the folder' do
|
||||||
|
result = subject.vms_in_pool(poolname)
|
||||||
|
|
||||||
|
expect(result).to eq(expected_vm_list)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#get_vm' do
|
describe '#get_vm' do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue