Project

General

Profile

« Previous | Next » 

Revision 91b8eed6

Added by Ondřej Pražák almost 6 years ago

Fixes #24125 - Show error when libvirt not reachable

View differences:

app/models/compute_resources/foreman/model/libvirt.rb
def new_vm(attr = { })
test_connection
return unless errors.empty?
libvirt_connection_error unless errors.empty?
opts = vm_instance_defaults.merge(attr.to_h).deep_symbolize_keys
# convert rails nested_attributes into a plain hash
......
protected
def libvirt_connection_error
msg = N_('Unable to connect to libvirt due to: %s. Please make sure your libvirt compute resource is reachable and that you have appropriate access permissions.')
raise Foreman::Exception.new(msg, errors.full_messages.join(', '))
end
def client
# WARNING potential connection leak
tries ||= 3

Also available in: Unified diff