mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Bail reporting an error before attempting to clone when required parameter is missing
This commit updates clone_vm in the vsphere provider to raise an error when a target folder can not be found. Without this change, if the target folder can not be found a clone is attempted anyway, resulting in an error and backtrace.
This commit is contained in:
parent
9634a724e5
commit
cb37d3b067
3 changed files with 15 additions and 2 deletions
|
|
@ -646,6 +646,18 @@ EOT
|
|||
end
|
||||
end
|
||||
|
||||
context 'when create_vm_folder returns nil' do
|
||||
before(:each) do
|
||||
template_vm = new_template_object
|
||||
allow(subject).to receive(:find_template_vm).and_return(new_template_object)
|
||||
expect(subject).to receive(:find_vm_folder).and_return(nil)
|
||||
end
|
||||
|
||||
it 'should raise an error' do
|
||||
expect{ subject.create_vm(poolname, vmname) }.to raise_error(ArgumentError)
|
||||
end
|
||||
end
|
||||
|
||||
context 'Given a successful creation' do
|
||||
let(:folder_object) { mock_RbVmomi_VIM_Folder({ :name => 'pool1'}) }
|
||||
before(:each) do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue