There is a problem in process return code:
operation_rc return type as object (cint) but
eSaAisErrorT.whatis require input type interger.
This fix is Correct input for eSaAisErrorT.whatis()

In addition, this ticket allow immadm python tool can run
without argument params.
---
 python/pyosaf/utils/immom/agent.py |  3 ++-
 python/samples/immadm              | 26 +++++++++++++-------------
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/python/pyosaf/utils/immom/agent.py 
b/python/pyosaf/utils/immom/agent.py
index b5a710628..7e961a191 100644
--- a/python/pyosaf/utils/immom/agent.py
+++ b/python/pyosaf/utils/immom/agent.py
@@ -294,7 +294,8 @@ class ImmOmAgent(OmAgentManager):
                         eSaAisErrorT.whatis(rc))
             elif operation_rc.value != eSaAisErrorT.SA_AIS_OK:
                 log_err("Administrative operation(%s) on %s FAILED - %s" %
-                        (op_id, object_dn, eSaAisErrorT.whatis(operation_rc)))
+                        (op_id, object_dn,
+                         eSaAisErrorT.whatis(operation_rc.value)))
 
         return rc
 
diff --git a/python/samples/immadm b/python/samples/immadm
index a03acafa0..e1a909488 100755
--- a/python/samples/immadm
+++ b/python/samples/immadm
@@ -62,19 +62,19 @@ def immadm(args):
     _params = []
 
     if params is not None:
-        try:
-            for param in params:
-                (name, val_type, val) = param.split(':', 2)
-                ptype = saImm.eSaImmValueTypeT.lookup[val_type]
-                val = cast(ptype, val)
-                _params.append(saImm.SaImmAdminOperationParamsT_2(
-                    name, ptype, val))
-            om_agent = ImmOmAgent()
-            om_agent.init()
-            rc = om_agent.invoke_admin_operation(dn, op_id, params=_params)
-        except SafException as err:
-            if err.value != eSaAisErrorT.SA_AIS_ERR_NOT_EXIST:
-                raise err
+        for param in params:
+            (name, val_type, val) = param.split(':', 2)
+            ptype = saImm.eSaImmValueTypeT.lookup[val_type]
+            val = cast(ptype, val)
+            _params.append(saImm.SaImmAdminOperationParamsT_2(
+                name, ptype, val))
+    try:
+        om_agent = ImmOmAgent()
+        om_agent.init()
+        rc = om_agent.invoke_admin_operation(dn, op_id, params=_params)
+    except SafException as err:
+        if err.value != eSaAisErrorT.SA_AIS_ERR_NOT_EXIST:
+            raise err
 
     return {'dn': dn,
             'opId': op_id,
-- 
2.25.1



_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to