python/pyosaf/utils/immoi/__init__.py |  17 ++---------------
 python/pyosaf/utils/immom/__init__.py |   6 ++++--
 2 files changed, 6 insertions(+), 17 deletions(-)


Use the SA_IMM_SEARCH_GET_CONFIG_ATTR flag in immoi.get_object_no_runtime() to 
only query config attributes and update immom.get() to handle it.

Verify by querying an object with both config and runtime attributes:

from pyosaf.utils import immoi
print immoi.get_object_no_runtime('<DN>')

diff --git a/python/pyosaf/utils/immoi/__init__.py 
b/python/pyosaf/utils/immoi/__init__.py
--- a/python/pyosaf/utils/immoi/__init__.py
+++ b/python/pyosaf/utils/immoi/__init__.py
@@ -267,7 +267,7 @@ def get_class_name_for_dn(dn):
     else:
         return None
 
-def get_object_no_runtime(dn, class_name=None):
+def get_object_no_runtime(dn):
     ''' returns the IMM object with the given DN
 
         this is safe to call from OI callbacks as only the config attributes
@@ -278,20 +278,7 @@ def get_object_no_runtime(dn, class_name
         it will be looked up.
     '''
 
-    if not class_name:
-        class_name = get_class_name_for_dn(dn)
-
-    class_desc = get_class_description(class_name)
-
-    config_attrs = []
-
-    for attr_desc in class_desc:
-        if attr_desc.attrFlags & saImm.saImm.SA_IMM_ATTR_CONFIG:
-            config_attrs.append(attr_desc.attrName)
-
-    obj = immom.get(dn, config_attrs)
-
-    return obj
+    return immom.get(dn, ['SA_IMM_SEARCH_GET_CONFIG_ATTR'])
 
 def cache_class_descriptions(class_names):
     ''' Explicitly caches the class description of the given class names 
diff --git a/python/pyosaf/utils/immom/__init__.py 
b/python/pyosaf/utils/immom/__init__.py
--- a/python/pyosaf/utils/immom/__init__.py
+++ b/python/pyosaf/utils/immom/__init__.py
@@ -84,8 +84,10 @@ def get(object_name, attr_name_list=None
     ''' obtain values of some attributes of the specified object '''
 
     # Always request the SaImmAttrClassName attribute if needed
-    if attr_name_list and not class_name and \
-       not 'SaImmAttrClassName' in attr_name_list:
+    if attr_name_list and                             \
+       not class_name and                             \
+       not 'SaImmAttrClassName' in attr_name_list and \
+       not attr_name_list == ['SA_IMM_SEARCH_GET_CONFIG_ATTR']:
         attr_name_list.append('SaImmAttrClassName')
 
     attrib_names = [SaImmAttrNameT(a) for a in attr_name_list]\

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

Reply via email to