From: David Lutterkort <[email protected]>
---
server/lib/cimi/models/machine.rb | 2 +-
tests/cimi/machine_collection_test.rb | 6 ++++++
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/server/lib/cimi/models/machine.rb
b/server/lib/cimi/models/machine.rb
index fbf25dd..9358c18 100644
--- a/server/lib/cimi/models/machine.rb
+++ b/server/lib/cimi/models/machine.rb
@@ -157,7 +157,7 @@ class CIMI::Model::Machine < CIMI::Model::Base
def self.convert_instance_memory(profile, context)
machine_conf = CIMI::Model::MachineConfiguration.find(profile.name,
context)
memory_override = profile.overrides.find { |p, v| p == :memory }
- memory_override.nil? ? machine_conf.memory :
context.to_kibibyte(memory_override[1].to_i,"MB")
+ memory_override.nil? ? machine_conf.memory.to_i :
context.to_kibibyte(memory_override[1].to_i,"MB")
end
def self.convert_instance_addresses(instance)
diff --git a/tests/cimi/machine_collection_test.rb
b/tests/cimi/machine_collection_test.rb
index a5ad3f4..c6b5b7b 100644
--- a/tests/cimi/machine_collection_test.rb
+++ b/tests/cimi/machine_collection_test.rb
@@ -33,4 +33,10 @@ class MachineCollectionBehavior < CIMI::Test::Spec
machines.wont_be_nil # Make sure we talk to the server
last_response.json["resourceURI"].must_equal RESOURCE_URI
end
+
+ it "should report integer values for memory" do
+ machines.entries.each do |machine|
+ machine.memory.to_s.must_match /^[0-9]+$/
+ end
+ end
end
--
1.7.7.6