Hi Johan,

Reviewed and tested the patch.
Ack from me.

BR,

Hung Nguyen - DEK Technologies


--------------------------------------------------------------------------------
From: Johan Martensson [email protected]
Sent: Thursday, January 21, 2016 1:43PM
To: Hans Nordeback, Mathivanan Naickan, Hung Nguyen, Srikanth Revanuru
     [email protected], [email protected], 
[email protected], [email protected]
Cc: Opensaf-devel
     [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)
+
          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