fog-openstack
fog-openstack copied to clipboard
Compute's mock detach_volume fails
trafficstars
attach_volume adds an entry to self.data[:volumes][volume_id], but detach_volume attempts to find it via self.data[:volumes][attachment_id]. Instead, it should find the volume in self.data[:volumes] that has an attachment with the given attachment_id:
volume = self.data[:volumes].find { |v| v['attachments'].any? { |a| a['id'] == attachment_id } }
if volume
volume['attachments'].reject! { |a| a['id'] == attachment_id && a['server_id'] == server_id }
end
https://github.com/fog/fog/blob/master/lib/fog/openstack/requests/compute/detach_volume.rb#L17
Original issue opened by @xian at fog/fog#3382
cc/ @xian @geemus