1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[rackspace|compute] fixing connection deprecation warnings

This commit is contained in:
Kyle Rames 2013-01-24 13:28:47 -06:00
parent 35ae326523
commit 19bf10b87d
2 changed files with 7 additions and 6 deletions

View file

@ -27,7 +27,7 @@ module Fog
ignore_attributes :metadata
def initialize(attributes={})
@connection = attributes[:connection]
@service = attributes[:service]
super
end
@ -35,7 +35,7 @@ module Fog
raise "Please save image before accessing metadata" unless identity
@metadata ||= begin
Fog::Compute::RackspaceV2::Metadata.new({
:connection => connection,
:service => service,
:parent => self
})
end

View file

@ -16,13 +16,14 @@ module Fog
def all
requires :parent
data = connection.list_metadata(collection_name, parent.id).body['metadata']
return unless parent.identity
data = service.list_metadata(collection_name, parent.id).body['metadata']
from_hash(data)
end
def get(key)
requires :parent
data = connection.get_metadata_item(collection_name, parent.id, key).body["meta"]
data = service.get_metadata_item(collection_name, parent.id, key).body["meta"]
datum = data.first
new(:key => datum[0], :value => datum[1])
rescue Fog::Compute::RackspaceV2::NotFound
@ -43,14 +44,14 @@ module Fog
if datum
data.value = value
else
self << Fog::Compute::RackspaceV2::Metadatum.new(:key => key, :value => value, :connection => connection, :parent => parent)
self << Fog::Compute::RackspaceV2::Metadatum.new(:key => key, :value => value, :service => service, :parent => parent)
end
value
end
def save
requires :parent
connection.set_metadata(collection_name, parent.id, to_hash)
service.set_metadata(collection_name, parent.id, to_hash)
end
def new(attributes = {})