mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Raise correct exception on domain not found
Update spec to check the actually exception raised and fix the code to raise the correct one instead of throwing constant not defined.
This commit is contained in:
parent
afb53addb1
commit
dde1b9bd43
@ -1,4 +1,5 @@
|
||||
require 'log4r'
|
||||
require 'vagrant-libvirt/errors'
|
||||
require 'vagrant-libvirt/util/timer'
|
||||
require 'vagrant/util/retryable'
|
||||
|
||||
@ -21,8 +22,11 @@ module VagrantPlugins
|
||||
env[:metrics] ||= {}
|
||||
|
||||
# Get domain object
|
||||
domain = env[:machine].provider.driver.connection.servers.get(env[:machine].id.to_s)
|
||||
raise NoDomainError if domain == nil
|
||||
domain = env[:machine].provider.driver.get_domain(env[:machine].id.to_s)
|
||||
if domain == nil
|
||||
raise Errors::NoDomainError,
|
||||
:error_message => "Domain #{env[:machine].id} not found"
|
||||
end
|
||||
|
||||
# Wait for domain to obtain an ip address. Ip address is searched
|
||||
# from arp table, either localy or remotely via ssh, if libvirt
|
||||
|
@ -23,7 +23,8 @@ describe VagrantPlugins::ProviderLibvirt::Action::WaitTillUp do
|
||||
|
||||
it "raises exception" do
|
||||
expect(app).to_not receive(:call)
|
||||
expect{subject.call(env)}.to raise_error
|
||||
expect{subject.call(env)}.to raise_error(::VagrantPlugins::ProviderLibvirt::Errors::NoDomainError,
|
||||
/No domain found. Domain dummy-vagrant_dummy not found/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user