зеркало из https://github.com/microsoft/fog.git
update rackspace models to match new identity/collection abstraction
This commit is contained in:
Родитель
5aaf86defa
Коммит
93954f73ff
|
@ -4,8 +4,9 @@ module Fog
|
|||
|
||||
class Server < Fog::Model
|
||||
|
||||
identity :id
|
||||
|
||||
attribute :admin_pass, 'adminPass'
|
||||
attribute :id
|
||||
attribute :name
|
||||
attribute :image_id, 'imageId'
|
||||
attribute :flavor_id, 'flavorId'
|
||||
|
@ -21,11 +22,6 @@ module Fog
|
|||
true
|
||||
end
|
||||
|
||||
def reload
|
||||
new_attributes = servers.get(@id).body['server']
|
||||
merge_attributes(new_attributes)
|
||||
end
|
||||
|
||||
def save
|
||||
options = { 'metadata' => @metadata, 'name' => @name, 'personality' => @personality }
|
||||
options = options.reject {|key, value| value.nil?}
|
||||
|
@ -34,16 +30,6 @@ module Fog
|
|||
true
|
||||
end
|
||||
|
||||
def servers
|
||||
@servers
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def servers=(new_servers)
|
||||
@servers = new_servers
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -15,8 +15,8 @@ module Fog
|
|||
})
|
||||
for server in data['servers']
|
||||
servers << Fog::Rackspace::Servers::Server.new({
|
||||
:connection => connection,
|
||||
:servers => servers
|
||||
:collection => servers,
|
||||
:connection => connection
|
||||
}.merge!(server))
|
||||
end
|
||||
servers
|
||||
|
@ -36,13 +36,13 @@ module Fog
|
|||
|
||||
def new(attributes = {})
|
||||
Fog::Rackspace::Servers::Server.new({
|
||||
:connection => connection,
|
||||
:servers => self
|
||||
:collection => self,
|
||||
:connection => connection
|
||||
}.merge!(attributes))
|
||||
end
|
||||
|
||||
def reload
|
||||
get(id)
|
||||
all
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче