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

one server: added interfaces_attributes

This commit is contained in:
Achim Ledermüller 2014-04-22 15:29:44 +02:00
parent b0a1a83745
commit 8df9eb12c5
3 changed files with 23 additions and 7 deletions

View file

@ -9,10 +9,8 @@ module Fog
identity :id
attribute :vnet
attribute :model
def uuid
:id
end
attribute :name
attribute :mac
def initialize attributes = {}
super defaults.merge(attributes)
@ -22,6 +20,10 @@ module Fog
raise Fog::Errors::Error.new('Creating a new interface is not yet implemented. Contributions welcome!')
end
def new?
mac.nil?
end
def destroy
raise Fog::Errors::Error.new('Destroying an interface is not yet implemented. Contributions welcome!')
end

View file

@ -29,6 +29,15 @@ module Fog
#reload
end
def interfaces
#[] << Fog::Compute::OpenNebula::Interfaces.new
[]
end
def interfaces_attributes=(attributes)
true
end
def vm_ip_address
ip
end

View file

@ -48,9 +48,14 @@ module Fog
temp = one["VM"]["TEMPLATE"]
data["cpu"] = temp["VCPU"] unless temp["VCPU"].nil?
data["memory"] = temp["MEMORY"] unless temp["MEMORY"].nil?
unless (temp["NIC"].nil?) then
data["mac"] = temp["NIC"]["MAC"] unless temp["NIC"]["MAC"].nil?
data["ip"] = temp["NIC"]["IP"] unless temp["NIC"]["IP"].nil?
unless (temp["NIC"].nil?) then
if one["VM"]["TEMPLATE"]["NIC"].is_a?(Array)
data["mac"] = temp["NIC"][0]["MAC"] unless temp["NIC"][0]["MAC"].nil?
data["ip"] = temp["NIC"][0]["IP"] unless temp["NIC"][0]["IP"].nil?
else
data["mac"] = temp["NIC"]["MAC"] unless temp["NIC"]["MAC"].nil?
data["ip"] = temp["NIC"]["IP"] unless temp["NIC"]["IP"].nil?
end
end
end