lib/openstack/compute/image.rb in openstack-compute-1.1.2 vs lib/openstack/compute/image.rb in openstack-compute-1.1.3
- old
+ new
@@ -26,29 +26,30 @@
# >> image.name
# => "CentOS 5.2"
def initialize(connection,id)
@id = id
@connection = connection
- @metadata = OpenStack::Compute::ImageMetadata.new(connection, id)
populate
end
# Makes the HTTP call to load information about the provided image. Can also be called directly on the Image object to refresh data.
# Returns true if the refresh call succeeds.
#
# >> image.populate
# => true
def populate
- response = @connection.csreq("GET",@connection.svrmgmthost,"#{@connection.svrmgmtpath}/images/#{URI.escape(self.id.to_s)}",@connection.svrmgmtport,@connection.svrmgmtscheme)
+ path = "/images/#{URI.escape(self.id.to_s)}"
+ response = @connection.req("GET", path)
OpenStack::Compute::Exception.raise_exception(response) unless response.code.match(/^20.$/)
data = JSON.parse(response.body)['image']
@id = data['id']
@name = data['name']
@server = data['server']
if data['updated'] then
@updated = DateTime.parse(data['updated'])
end
@created = DateTime.parse(data['created'])
+ @metadata = OpenStack::Compute::Metadata.new(@connection, path, data['metadata'])
@status = data['status']
@minDisk = data['minDisk']
@minRam = data['minRam']
@progress = data['progress']
return true