mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
(GH-203) Change use of abort to raise in in vsphere_helper.rb
Previously, in `find_vm` and `find_pool` if in an expected object was found the entire pool manager, and probably API process, will terminate due to the use of `abort`. This commit changes the use of abort to raise so that the error can be trapped and handled instead of the entire process being shutdown. This is also required so that the methods can be tested, otherwise rspec is shutdown prematurely.
This commit is contained in:
parent
07eb4f579a
commit
fd93c5bea8
1 changed files with 2 additions and 2 deletions
|
|
@ -181,7 +181,7 @@ module Vmpooler
|
|||
if base.is_a? RbVmomi::VIM::Folder
|
||||
base = base.childEntity.find { |f| f.name == folder }
|
||||
else
|
||||
abort "Unexpected object type encountered (#{base.class}) while finding folder"
|
||||
raise(RuntimeError, "Unexpected object type encountered (#{base.class}) while finding folder")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -284,7 +284,7 @@ module Vmpooler
|
|||
when base.is_a?(RbVmomi::VIM::ResourcePool)
|
||||
base = base.resourcePool.find { |f| f.name == pool }
|
||||
else
|
||||
abort "Unexpected object type encountered (#{base.class}) while finding resource pool"
|
||||
raise(RuntimeError, "Unexpected object type encountered (#{base.class}) while finding resource pool")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue