lib/fog/aws/models/compute/image.rb in fog-0.3.22 vs lib/fog/aws/models/compute/image.rb in fog-0.3.23
- old
+ new
@@ -22,21 +22,17 @@
attribute :root_device_type, :aliases => 'rootDeviceType'
attribute :root_device_name, :aliases => 'rootDeviceName'
attribute :tags, :aliases => 'tagSet'
def deregister(delete_snapshot = false)
- connection.deregister_image(@id)
+ connection.deregister_image(id)
- if(delete_snapshot && @root_device_type=="ebs")
- @block_device_mapping.each do |block_device|
- next if block_device["deviceName"] != @root_device_name
- snapshot_id = block_device["snapshotId"]
- snapshot = @connection.snapshots.get(snapshot_id)
- return snapshot.destroy
- end
+ if(delete_snapshot && root_device_type == "ebs")
+ block_device = block_device_mapping.select {|block_device| block_device['deviceName'] == root_device_name}
+ @connection.snapshots.new(:id => block_device['snapshotId']).destroy
+ else
+ true
end
-
- return true
end
end
end