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:
parent
67a63c5a2a
commit
a859b9ecf5
3 changed files with 4 additions and 11 deletions
|
@ -23,16 +23,13 @@ module Fog
|
||||||
attribute :minRam
|
attribute :minRam
|
||||||
attribute :disk_config, :aliases => 'OS-DCF:diskConfig'
|
attribute :disk_config, :aliases => 'OS-DCF:diskConfig'
|
||||||
attribute :links
|
attribute :links
|
||||||
|
|
||||||
ignore_attributes :metadata
|
|
||||||
|
|
||||||
def initialize(attributes={})
|
def initialize(attributes={})
|
||||||
@connection = attributes[:connection]
|
@connection = attributes[:connection]
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def metadata
|
def metadata
|
||||||
raise "Please save image before accessing metadata" unless identity
|
|
||||||
@metadata ||= begin
|
@metadata ||= begin
|
||||||
Fog::Compute::RackspaceV2::Metadata.new({
|
Fog::Compute::RackspaceV2::Metadata.new({
|
||||||
:connection => connection,
|
:connection => connection,
|
||||||
|
@ -42,7 +39,6 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def metadata=(hash={})
|
def metadata=(hash={})
|
||||||
raise "Please save image before accessing metadata" unless identity
|
|
||||||
metadata.from_hash(hash)
|
metadata.from_hash(hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ module Fog
|
||||||
|
|
||||||
def all
|
def all
|
||||||
requires :parent
|
requires :parent
|
||||||
|
return unless parent.identity
|
||||||
data = connection.list_metadata(collection_name, parent.id).body['metadata']
|
data = connection.list_metadata(collection_name, parent.id).body['metadata']
|
||||||
from_hash(data)
|
from_hash(data)
|
||||||
end
|
end
|
||||||
|
|
|
@ -41,9 +41,7 @@ module Fog
|
||||||
attribute :addresses
|
attribute :addresses
|
||||||
attribute :flavor_id, :aliases => 'flavor', :squash => 'id'
|
attribute :flavor_id, :aliases => 'flavor', :squash => 'id'
|
||||||
attribute :image_id, :aliases => 'image', :squash => 'id'
|
attribute :image_id, :aliases => 'image', :squash => 'id'
|
||||||
|
|
||||||
ignore_attributes :metadata
|
|
||||||
|
|
||||||
attr_reader :password
|
attr_reader :password
|
||||||
|
|
||||||
def initialize(attributes={})
|
def initialize(attributes={})
|
||||||
|
@ -57,7 +55,6 @@ module Fog
|
||||||
alias :access_ipv6_address= :ipv6_address=
|
alias :access_ipv6_address= :ipv6_address=
|
||||||
|
|
||||||
def metadata
|
def metadata
|
||||||
raise "Please save server before accessing metadata" unless identity
|
|
||||||
@metadata ||= begin
|
@metadata ||= begin
|
||||||
Fog::Compute::RackspaceV2::Metadata.new({
|
Fog::Compute::RackspaceV2::Metadata.new({
|
||||||
:service => service,
|
:service => service,
|
||||||
|
@ -67,7 +64,6 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def metadata=(hash={})
|
def metadata=(hash={})
|
||||||
raise "Please save server before accessing metadata" unless identity
|
|
||||||
metadata.from_hash(hash)
|
metadata.from_hash(hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -85,7 +81,7 @@ module Fog
|
||||||
|
|
||||||
options = {}
|
options = {}
|
||||||
options[:disk_config] = disk_config unless disk_config.nil?
|
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?
|
options[:personality] = personality unless personality.nil?
|
||||||
|
|
||||||
data = service.create_server(name, image_id, flavor_id, 1, 1, options)
|
data = service.create_server(name, image_id, flavor_id, 1, 1, options)
|
||||||
|
|
Loading…
Reference in a new issue