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

name is now a required param for create_server

This commit is contained in:
Wesley Beary 2009-11-18 18:22:38 -08:00
parent 7e3a4810ef
commit 66ee22f6c3
14 changed files with 17 additions and 17 deletions

View file

@ -23,9 +23,9 @@ module Fog
end
def save
options = { 'metadata' => @metadata, 'name' => @name, 'personality' => @personality }
options = { 'metadata' => @metadata, 'personality' => @personality }
options = options.reject {|key, value| value.nil?}
data = connection.create_server(@flavor_id, @image_id, options)
data = connection.create_server(@flavor_id, @image_id, @name, options)
merge_attributes(data.body['server'])
true
end

View file

@ -34,7 +34,7 @@ unless Fog.mocking?
# * 'name<~String> - Name of server
# * 'progress'<~Integer> - Progress through current status
# * 'status'<~String> - Current server status
def create_server(flavor_id, image_id, options = {})
def create_server(flavor_id, image_id, name, options = {})
data = {
'server' => {
'flavorId' => flavor_id,
@ -74,7 +74,7 @@ else
module Rackspace
class Servers
def create_server(flavor_id, image_id, options = {})
def create_server(flavor_id, image_id, name, options = {})
response = Fog::Response.new
response.status = 202
@ -85,10 +85,10 @@ else
'imageId' => image_id,
'hostId' => "123456789ABCDEF01234567890ABCDEF",
'metadata' => options[:metadata] || {},
'name' => name,
'progress' => 0,
'status' => 'BUILD'
}
data['name'] = "slice#{data[:id]}"
data['adminPass'] = "#{data['name']}password"
Fog::Rackspace::Servers.data[:last_modified][data['id']] = Time.now
Fog::Rackspace::Servers.data[:servers][data['id']] = data

View file

@ -5,7 +5,7 @@ describe 'Rackspace::Servers.create_image' do
before(:each) do
# flavor 1 = 256, image 3 = gentoo 2008.0
@server_id = servers.create_server(1, 3).body['server']['id']
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
end
after(:each) do

View file

@ -11,7 +11,7 @@ describe 'Rackspace::Servers.create_server' do
it "should return proper attributes" do
# flavor 1 = 256, image 3 = gentoo 2008.0
actual = servers.create_server(1, 3).body['server']
actual = servers.create_server(1, 3, 'name').body['server']
@server_id = actual['id']
actual['addresses'].should be_a(Hash)
actual['addresses']['private'].should be_an(Array)

View file

@ -5,7 +5,7 @@ describe 'Rackspace::Servers.delete_image' do
before(:each) do
# flavor 1 = 256, image 3 = gentoo 2008.0
@server_id = servers.create_server(1, 3).body['server']['id']
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
@image_id = servers.create_image(@server_id).body['image']['id']
end

View file

@ -5,7 +5,7 @@ describe 'Rackspace::Servers.delete_server' do
before(:each) do
# flavor 1 = 256, image 3 = gentoo 2008.0
@server_id = servers.create_server(1, 3).body['server']['id']
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
end
it "should return proper attributes" do

View file

@ -5,7 +5,7 @@ describe 'Rackspace::Servers.get_server_details' do
before(:each) do
# flavor 1 = 256, image 3 = gentoo 2008.0
@server_id = servers.create_server(1, 3).body['server']['id']
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
end
after(:each) do

View file

@ -5,7 +5,7 @@ describe 'Rackspace::Servers.list_addresses' do
before(:each) do
# flavor 1 = 256, image 3 = gentoo 2008.0
@server_id = servers.create_server(1, 3).body['server']['id']
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
end
after(:each) do

View file

@ -5,7 +5,7 @@ describe 'Rackspace::Servers.list_private_addresses' do
before(:each) do
# flavor 1 = 256, image 3 = gentoo 2008.0
@server_id = servers.create_server(1, 3).body['server']['id']
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
end
after(:each) do

View file

@ -5,7 +5,7 @@ describe 'Rackspace::Servers.list_public_addresses' do
before(:each) do
# flavor 1 = 256, image 3 = gentoo 2008.0
@server_id = servers.create_server(1, 3).body['server']['id']
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
end
after(:each) do

View file

@ -5,7 +5,7 @@ describe 'Rackspace::Servers.list_servers_detail' do
before(:each) do
# flavor 1 = 256, image 3 = gentoo 2008.0
@server_id = servers.create_server(1, 3).body['server']['id']
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
end
after(:each) do

View file

@ -5,7 +5,7 @@ describe 'Rackspace::Servers.list_servers' do
before(:each) do
# flavor 1 = 256, image 3 = gentoo 2008.0
@server_id = servers.create_server(1, 3).body['server']['id']
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
end
after(:each) do

View file

@ -5,7 +5,7 @@ describe 'Rackspace::Servers.reboot_server' do
before(:each) do
# flavor 1 = 256, image 3 = gentoo 2008.0
@server_id = servers.create_server(1, 3).body['server']['id']
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
end
after(:each) do

View file

@ -5,7 +5,7 @@ describe 'Rackspace::Servers.update_server' do
before(:each) do
# flavor 1 = 256, image 3 = gentoo 2008.0
@server_id = servers.create_server(1, 3).body['server']['id']
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
end
after(:each) do