From 450beceaa7cb2765cef82b0be8fe42ca591fb7a3 Mon Sep 17 00:00:00 2001 From: Matheus Mina Date: Tue, 10 Dec 2013 11:20:31 -0200 Subject: [PATCH 1/3] changed __consoles to consoles and renamed consoles method to get_consoles --- lib/fog/xenserver/models/compute/server.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/fog/xenserver/models/compute/server.rb b/lib/fog/xenserver/models/compute/server.rb index e3ab7fa71..dd7b0766b 100644 --- a/lib/fog/xenserver/models/compute/server.rb +++ b/lib/fog/xenserver/models/compute/server.rb @@ -14,7 +14,7 @@ module Fog attribute :name, :aliases => :name_label attribute :__affinity, :aliases => :affinity attribute :allowed_operations - attribute :__consoles + attribute :consoles attribute :domarch attribute :domid attribute :tags @@ -64,8 +64,8 @@ module Fog service.hosts.get __affinity end - def consoles - __consoles.collect {|console| service.consoles.get console } + def get_consoles + consoles.collect {|console| service.consoles.get console } end def destroy From e74c2a5e354449b51d4cbee75ada4a8462ed315d Mon Sep 17 00:00:00 2001 From: Matheus Mina Date: Tue, 10 Dec 2013 11:38:46 -0200 Subject: [PATCH 2/3] fixed tests --- tests/xenserver/models/compute/server_tests.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/xenserver/models/compute/server_tests.rb b/tests/xenserver/models/compute/server_tests.rb index eeb3f6691..18aa5437e 100644 --- a/tests/xenserver/models/compute/server_tests.rb +++ b/tests/xenserver/models/compute/server_tests.rb @@ -31,7 +31,7 @@ Shindo.tests('Fog::Compute[:xenserver] | server model', ['xenserver']) do :is_a_template, :__affinity, :allowed_operations, - :__consoles, + :consoles, :domarch, :domid, :__guest_metrics, @@ -113,8 +113,8 @@ Shindo.tests('Fog::Compute[:xenserver] | server model', ['xenserver']) do end tests('return valid consoles') do - test('as an array') { server.consoles.kind_of? Array } - server.consoles.each { |i| + test('as an array') { server.get_consoles.kind_of? Array } + server.get_consoles.each { |i| test('and each Console should be a Fog::Compute::XenServer::Console') { i.kind_of? Fog::Compute::XenServer::Console } } end From d4885dbe4d9cadd177021f0204bbd49d4e2e7b01 Mon Sep 17 00:00:00 2001 From: Matheus Mina Date: Wed, 11 Dec 2013 16:49:49 -0200 Subject: [PATCH 3/3] fixed consoles to use :aliases --- lib/fog/xenserver/models/compute/server.rb | 6 +++--- tests/xenserver/models/compute/server_tests.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/fog/xenserver/models/compute/server.rb b/lib/fog/xenserver/models/compute/server.rb index dd7b0766b..45543c64b 100644 --- a/lib/fog/xenserver/models/compute/server.rb +++ b/lib/fog/xenserver/models/compute/server.rb @@ -14,7 +14,7 @@ module Fog attribute :name, :aliases => :name_label attribute :__affinity, :aliases => :affinity attribute :allowed_operations - attribute :consoles + attribute :__consoles, :aliases => :consoles attribute :domarch attribute :domid attribute :tags @@ -64,8 +64,8 @@ module Fog service.hosts.get __affinity end - def get_consoles - consoles.collect {|console| service.consoles.get console } + def consoles + __consoles.collect {|console| service.consoles.get console } end def destroy diff --git a/tests/xenserver/models/compute/server_tests.rb b/tests/xenserver/models/compute/server_tests.rb index 18aa5437e..eeb3f6691 100644 --- a/tests/xenserver/models/compute/server_tests.rb +++ b/tests/xenserver/models/compute/server_tests.rb @@ -31,7 +31,7 @@ Shindo.tests('Fog::Compute[:xenserver] | server model', ['xenserver']) do :is_a_template, :__affinity, :allowed_operations, - :consoles, + :__consoles, :domarch, :domid, :__guest_metrics, @@ -113,8 +113,8 @@ Shindo.tests('Fog::Compute[:xenserver] | server model', ['xenserver']) do end tests('return valid consoles') do - test('as an array') { server.get_consoles.kind_of? Array } - server.get_consoles.each { |i| + test('as an array') { server.consoles.kind_of? Array } + server.consoles.each { |i| test('and each Console should be a Fog::Compute::XenServer::Console') { i.kind_of? Fog::Compute::XenServer::Console } } end