On 08/10/2011 04:52 PM, tsedovic(a)redhat.com wrote:
From: Tomas Sedovic<tsedovic(a)redhat.com>
When an instance was being launched, there was a problem when its hardware
profile contained `nil` value for the `enum` type.
`nil` in that context means "match anything", so that's what it does now.
---
src/app/models/hardware_profile.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/app/models/hardware_profile.rb b/src/app/models/hardware_profile.rb
index 57d5fd8..b6570a9 100644
--- a/src/app/models/hardware_profile.rb
+++ b/src/app/models/hardware_profile.rb
@@ -178,7 +178,7 @@ class HardwareProfile< ActiveRecord::Base
return front_end_property.value
when "enum"
create_array_from_property(back_end_property).sort!.each do |value|
- if BigDecimal.new(value)>= BigDecimal.new(front_end_property.value)
+ if front_end_property.value.nil? or BigDecimal.new(value)>=
BigDecimal.new(front_end_property.value)
return value
end
end
Ha, this looks familiar :)
(
https://fedorahosted.org/pipermail/aeolus-devel/2011-July/003517.html).
I sent it w/o test too, it was bug found after deadline. Now as we are
not in time pressure, I think we should add test for this. It should be
pretty easy - rspec which calls
HardwareProfile.generate_override_property_values method with nil value.
Can do it too, whatever you prefer.
Jan