Hi Dies, it's a little hard to diagnose what's going on there; it seems to happen because the code makes an assumption that an attribute of type hash_map is never nil (i.e., will be initialized at some point)
I think that assumption is nonsense. See if the attached patch fixes things for you - if it does, please include it with your patch series. David
>From d33c82eb6b450dfda7290d799ed7cfed810d1589 Mon Sep 17 00:00:00 2001 From: David Lutterkort <lut...@redhat.com> Date: Wed, 27 Mar 2013 12:26:36 -0700 Subject: [PATCH] CIMI schema: tolerate nil hash_map attributes --- server/lib/cimi/models/schema.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/server/lib/cimi/models/schema.rb b/server/lib/cimi/models/schema.rb index 5a2049b..aaf7cad 100644 --- a/server/lib/cimi/models/schema.rb +++ b/server/lib/cimi/models/schema.rb @@ -268,13 +268,21 @@ class CIMI::Model::Schema end def to_xml(model, xml) - ary = (model[name] || {}).map { |k, v| { "key" => k, "content" => v } } - xml[xml_name] = ary unless ary.empty? + mapped = extract(model).map { |k, v| { "key" => k, "content" => v } } + xml[xml_name] = mapped unless mapped.empty? end def to_json(model, json) - if model[name] && ! model[name].empty? - json[json_name] = model[name] + h = extract(model) + json[json_name] = h unless h.empty? + end + + private + def extract(model) + if model.respond_to?("[]") + model[name] || {} + else + {} end end end -- 1.8.1.4