Project

General

Profile

« Previous | Next » 

Revision 3baac1fa

Added by Timo Goebel almost 6 years ago

fixes #24186 - improve vsphere error handling

View differences:

app/models/compute_resources/foreman/model/vmware.rb
end
def create_vm(args = { })
vm = nil
test_connection
return unless errors.empty?
......
vm.firmware = 'bios' if vm.firmware == 'automatic'
vm.save
end
rescue Fog::Compute::Vsphere::NotFound => e
Foreman::Logging.exception('Caught VMware error', e)
raise ::Foreman::WrappedException.new(
e,
N_(
'Foreman could not find a required vSphere resource. Check if Foreman has the required permissions and the resource exists. Reason: %s'
)
)
rescue Fog::Errors::Error => e
Foreman::Logging.exception("Unhandled VMware error", e)
destroy_vm vm.id if vm&.id
destroy_vm(vm.id) if vm&.id
raise e
end

Also available in: Unified diff