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

[rackspace|compute] this should address a metadata issue discovered in chef http://tickets.opscode.com/browse/KNIFE-217

This commit is contained in:
Kyle Rames 2013-01-22 15:34:52 -06:00
parent 67a63c5a2a
commit a859b9ecf5
3 changed files with 4 additions and 11 deletions

View file

@ -23,16 +23,13 @@ module Fog
attribute :minRam
attribute :disk_config, :aliases => 'OS-DCF:diskConfig'
attribute :links
ignore_attributes :metadata
def initialize(attributes={})
@connection = attributes[:connection]
super
end
def metadata
raise "Please save image before accessing metadata" unless identity
@metadata ||= begin
Fog::Compute::RackspaceV2::Metadata.new({
:connection => connection,
@ -42,7 +39,6 @@ module Fog
end
def metadata=(hash={})
raise "Please save image before accessing metadata" unless identity
metadata.from_hash(hash)
end

View file

@ -16,6 +16,7 @@ module Fog
def all
requires :parent
return unless parent.identity
data = connection.list_metadata(collection_name, parent.id).body['metadata']
from_hash(data)
end

View file

@ -41,9 +41,7 @@ module Fog
attribute :addresses
attribute :flavor_id, :aliases => 'flavor', :squash => 'id'
attribute :image_id, :aliases => 'image', :squash => 'id'
ignore_attributes :metadata
attr_reader :password
def initialize(attributes={})
@ -57,7 +55,6 @@ module Fog
alias :access_ipv6_address= :ipv6_address=
def metadata
raise "Please save server before accessing metadata" unless identity
@metadata ||= begin
Fog::Compute::RackspaceV2::Metadata.new({
:service => service,
@ -67,7 +64,6 @@ module Fog
end
def metadata=(hash={})
raise "Please save server before accessing metadata" unless identity
metadata.from_hash(hash)
end
@ -85,7 +81,7 @@ module Fog
options = {}
options[:disk_config] = disk_config unless disk_config.nil?
options[:metadata] = metadata unless @metadata.nil?
options[:metadata] = metadata.to_hash unless @metadata.nil?
options[:personality] = personality unless personality.nil?
data = service.create_server(name, image_id, flavor_id, 1, 1, options)