mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Handle nil volumes when cd-rom attached (#1273)
When a cd-rom is attached as an additional storage, listing the volumes can include a nil element. Make sure to check that the element is valid before attempting to access the attribute. Update the test to better match the observed behaviour. Fixes: #1209, #1262
This commit is contained in:
@@ -70,7 +70,7 @@ module VagrantPlugins
|
||||
|
||||
# remove root storage
|
||||
root_disk = domain.volumes.select do |x|
|
||||
x.name == libvirt_domain.name + '.img'
|
||||
x.name == libvirt_domain.name + '.img' if x
|
||||
end.first
|
||||
root_disk.destroy if root_disk
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user