You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2011/11/16 14:10:08 UTC
CIMI: Added singularize method to CIMI struct name
Hi,
This small patch should fix the issue when:
<volumes>
<volume>...</volume>
the <volumes> is parsed as CIMI_Volumes instead of CIMI_Volume
-- Michal
Re: CIMI: Added singularize method to CIMI struct name
Posted by Tong Li <li...@us.ibm.com>.
Tong Li
Emerging Technologies & Standards
Building 501/B205
litong01@us.ibm.com
David Lutterkort <lu...@redhat.com> wrote on 11/16/2011 12:26:44 PM:
> From: David Lutterkort <lu...@redhat.com>
> To: deltacloud-dev@incubator.apache.org
> Date: 11/16/2011 02:54 PM
> Subject: Re: CIMI: Added singularize method to CIMI struct name
>
> On Wed, 2011-11-16 at 14:10 +0100, mfojtik@redhat.com wrote:
> > Hi,
> >
> > This small patch should fix the issue when:
> >
> > <volumes>
> > <volume>...</volume>
> >
> > the <volumes> is parsed as CIMI_Volumes instead of CIMI_Volume
>
> Where does this come from ? I thought all arrays in CIMI were just a
> sequence of <singular_name/> tags.
>
Right, there is not such nested elements in any of the XML representation.
> David
>
>
Re: CIMI: Added singularize method to CIMI struct name
Posted by David Lutterkort <lu...@redhat.com>.
On Wed, 2011-11-16 at 14:10 +0100, mfojtik@redhat.com wrote:
> Hi,
>
> This small patch should fix the issue when:
>
> <volumes>
> <volume>...</volume>
>
> the <volumes> is parsed as CIMI_Volumes instead of CIMI_Volume
Where does this come from ? I thought all arrays in CIMI were just a
sequence of <singular_name/> tags.
David
[PATCH core] CIMI: Added .singularize method to CIMI_element_name
Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
server/lib/cimi/model/schema.rb | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/server/lib/cimi/model/schema.rb b/server/lib/cimi/model/schema.rb
index 4bed002..9e010d3 100644
--- a/server/lib/cimi/model/schema.rb
+++ b/server/lib/cimi/model/schema.rb
@@ -132,11 +132,11 @@ class CIMI::Model::Schema
private
def struct
- cname = "CIMI_#{json_name.upcase_first}"
+ cname = "CIMI_#{json_name.upcase_first.singularize}"
if ::Struct.const_defined?(cname)
::Struct.const_get(cname)
else
- ::Struct.new("CIMI_#{json_name.upcase_first}",
+ ::Struct.new("CIMI_#{json_name.upcase_first.singularize}",
*@schema.attribute_names)
end
end
--
1.7.4.4