Thanks!

In my test program I used "3" as the RDN value and the code below still worked 
as "3"[0] == '3'. I will fix and send an updated version.

/ Johan

From: Hung Nguyen [mailto:[email protected]]
Sent: den 21 januari 2016 13:23
To: Johan Mårtensson O; Hans Nordebäck; [email protected]; 
[email protected]
Cc: [email protected]
Subject: Re: [PATCH 1 of 1] pyosaf: Fix Ccb and ImmObject classes to handle 
more inputs [#1663]


Hi Johan,



Please find my comment inline.





BR,

Hung Nguyen - DEK Technologies


--------------------------------------------------------------------------------

From: Johan Martensson 
[email protected]<mailto:[email protected]>

Sent: Monday, January 18, 2016 9:45AM

To: Hans Nordeback, Mathivanan Naickan, Hung Nguyen, Srikanth Revanuru

    [email protected]<mailto:[email protected]>, 
[email protected]<mailto:[email protected]>, 
[email protected]<mailto:[email protected]>, 
[email protected]<mailto:[email protected]>

Cc: Opensaf-devel

    
[email protected]<mailto:[email protected]>

Subject: [PATCH 1 of 1] pyosaf: Fix Ccb and ImmObject classes to handle more 
inputs [#1663]





 python/pyosaf/utils/immom/ccb.py    |  12 ++++++++++++

 python/pyosaf/utils/immom/object.py |   5 +++++

 2 files changed, 17 insertions(+), 0 deletions(-)





Fix the Ccb class to allow entering values as atoms in modify

operations when there is only a single value affected.



Fix ImmObject to automatically prepend <rdn-attribute-name>= to the RDN 
attribute value to make it adhere to the format expected by IMM, if the user 
only provided the actual value.



diff --git a/python/pyosaf/utils/immom/ccb.py b/python/pyosaf/utils/immom/ccb.py

--- a/python/pyosaf/utils/immom/ccb.py

+++ b/python/pyosaf/utils/immom/ccb.py

@@ -159,6 +159,10 @@ class Ccb(object):



         assert object_name



+        # Make sure the values field is a list

+        if not isinstance(values, list):

+            values = [values]

+

         # first get class name to read class description to get value type...

         try:

             obj = immom.get(object_name)

@@ -204,6 +208,10 @@ class Ccb(object):



         assert object_name



+        # Make sure the values field is a list

+        if not isinstance(values, list):

+            values = [values]

+

         # first get class name to read class description to get value type...

         try:

             obj = immom.get(object_name)

@@ -248,6 +256,10 @@ class Ccb(object):



         assert object_name



+        # Make sure the values field is a list

+        if not isinstance(values, list):

+            values = [values]

+

         # first get class name to read class description to get value type...

         try:

             obj = immom.get(object_name)

diff --git a/python/pyosaf/utils/immom/object.py 
b/python/pyosaf/utils/immom/object.py

--- a/python/pyosaf/utils/immom/object.py

+++ b/python/pyosaf/utils/immom/object.py

@@ -101,6 +101,11 @@ class ImmObject(object):

             return False



     def __setattr__(self, key, value):

+        # Correct RDN assignments missing the RDN attribute name in the value

+        # part

+        if key == self.rdn_attribute and value.find(self.rdn_attribute) != 0:

+            value = '%s=%s' % (self.rdn_attribute, value[0])

[Hung] If 'value' is not a list then 'value[0]' is not correct here.

I think we should raise exception when users try to set RDN with a list.

RDN attributes are not multi-valued attributes.



Or maybe we can allow to set RDN with a list by just taking the first item and 
ignoring the rest.





+

         value_type = self.get_value_type(key)

         if type(value) is list:

             attr_value = (value_type, value)

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to