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

Implemented bootstrap method for Rackspace Compute v2.

Added ability to set "metadata" and "personality" fields when creating a server on Rackspace Compute v2.
Improved response parsing when dealing with Rackspace DNS service.
This commit is contained in:
Jesse Scott 2012-09-11 09:45:14 -07:00
parent dc28c7be85
commit ea179666a4
4 changed files with 17 additions and 2 deletions

View file

@ -54,7 +54,7 @@ module Fog
def create
requires :name, :image_id, :flavor_id
data = connection.create_server(name, image_id, flavor_id, 1, 1)
data = connection.create_server(name, image_id, flavor_id, 1, 1, attributes)
merge_attributes(data.body['server'])
true
end

View file

@ -13,6 +13,13 @@ module Fog
load(data)
end
def bootstrap(new_attributes = {})
server = create(new_attributes)
server.wait_for { ready? }
#server.setup(:password => server.password)
server
end
def get(server_id)
data = connection.get_server(server_id).body['server']
new(data)

View file

@ -1,5 +1,6 @@
require 'fog/core/model'
require 'fog/rackspace/models/dns/callback'
require 'ipaddr'
module Fog
module DNS
@ -55,7 +56,12 @@ module Fog
end
response = wait_for_job connection.add_records(@zone.identity, [options]).body['jobId']
if ['A', 'AAAA'].include?(self.type.upcase)
merge_attributes(response.body['response']['records'].select {|record| record['name'] == self.name && record['type'] == self.type && IPAddr.new(record['data']) == IPAddr.new(self.value)}.first)
else
merge_attributes(response.body['response']['records'].select {|record| record['name'] == self.name && record['type'] == self.type && record['data'] == self.value}.first)
end
true
end

View file

@ -14,6 +14,8 @@ module Fog
}
data['server']['diskConfig'] = options[:disk_config] unless options[:disk_config].nil?
data['server']['metadata'] = options[:metadata] unless options[:metadata].nil?
data['server']['personality'] = options[:personality] unless options[:personality].nil?
request(
:body => Fog::JSON.encode(data),