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:
parent
7e3a4810ef
commit
66ee22f6c3
14 changed files with 17 additions and 17 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue