From ff70ff2b1b076079fef5e724341fbea2338ca703 Mon Sep 17 00:00:00 2001 From: Marcus Nilsson Date: Wed, 14 May 2014 22:02:37 +0200 Subject: [PATCH] Added ip_address methods consistent with openstack --- lib/fog/cloudstack/models/compute/server.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/fog/cloudstack/models/compute/server.rb b/lib/fog/cloudstack/models/compute/server.rb index 2553b755d..459a61ff0 100644 --- a/lib/fog/cloudstack/models/compute/server.rb +++ b/lib/fog/cloudstack/models/compute/server.rb @@ -49,6 +49,22 @@ module Fog nics.map{|nic| Address.new(nic)} end + def ip_addresses + addresses.map{|a| a.ip_address} + end + + def public_ip_addresses + if public_ip_address.nil? then [public_ip_address] else [] end + end + + def private_ip_addresses + ip_addresses - public_ip_addresses + end + + def private_ip_address + private_ip_addresses.first + end + def destroy(options={}) requires :id data = service.destroy_virtual_machine(options.merge({'id'=> self.id}))