mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Allow DHCP assignment by default.
This commit is contained in:
parent
212ea7b3ed
commit
d34abe2a33
2 changed files with 11 additions and 3 deletions
|
@ -21,6 +21,8 @@ module Fog
|
|||
attribute :status
|
||||
attribute :user
|
||||
attribute :started
|
||||
attribute :nic_0_model, :aliases => 'nic:0:model'
|
||||
attribute :nic_0_dhcp, :aliases => 'nic:0:dhcp'
|
||||
|
||||
def save
|
||||
attributes = {}
|
||||
|
@ -30,7 +32,7 @@ module Fog
|
|||
else
|
||||
requires :name
|
||||
requires :cpu
|
||||
attributes = connection.create_server(allowed_attributes).body
|
||||
attributes = connection.create_server(self.defaults.merge(allowed_attributes)).body
|
||||
end
|
||||
|
||||
merge_attributes(attributes)
|
||||
|
@ -47,6 +49,10 @@ module Fog
|
|||
allowed = [:name, :cpu, :mem, :persistent, :vnc_password]
|
||||
attributes.select {|k,v| allowed.include? k}
|
||||
end
|
||||
|
||||
def self.defaults
|
||||
{ 'nic:0:model' => 'e1000', 'nic:0:dhcp' => 'auto' }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,7 +9,9 @@ Shindo.tests('Fog::Compute[:serverlove] | server requests', ['serverlove']) do
|
|||
'cpu' => Integer,
|
||||
'mem' => Integer,
|
||||
'persistent' => Fog::Nullable::String,
|
||||
'vnc:password' => Fog::Nullable::String
|
||||
'vnc:password' => Fog::Nullable::String,
|
||||
'nic:0:dhcp' => String,
|
||||
'nic:0:model' => String
|
||||
}
|
||||
|
||||
tests('success') do
|
||||
|
@ -17,7 +19,7 @@ Shindo.tests('Fog::Compute[:serverlove] | server requests', ['serverlove']) do
|
|||
attributes = { 'name' => 'Test', 'cpu' => '1000', 'mem' => '1000', 'persistent' => 'true' }
|
||||
|
||||
tests("#create_server").formats(@server_format) do
|
||||
@server = Fog::Compute[:serverlove].create_server(attributes).body
|
||||
@server = Fog::Compute[:serverlove].create_server(Fog::Compute::Serverlove::Server.defaults.merge(attributes)).body
|
||||
end
|
||||
|
||||
tests("#list_servers").succeeds do
|
||||
|
|
Loading…
Reference in a new issue