Repository :
http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
---------------------------------------------------------------
commit 655d6a36ca7c358e7654fe49cbeb365f3f1c623f
Author: Peter Hatina <phatina(a)redhat.com>
Date: Tue Oct 14 08:10:24 2014 +0200
improve exception wrapping
CIMError and ConnectionError now contain more informative args when executing CIM
operations.
---------------------------------------------------------------
cli/lmi/shell/LMICIMXMLClient.py | 83 +++++++++++++++-----------
cli/lmi/shell/LMIClass.py | 6 +-
cli/lmi/shell/LMIDecorators.py | 117 +++++++++++++++++++-------------------
cli/lmi/shell/LMIWSMANClient.py | 76 +++++++++++++-----------
4 files changed, 150 insertions(+), 132 deletions(-)
diff --git a/cli/lmi/shell/LMICIMXMLClient.py b/cli/lmi/shell/LMICIMXMLClient.py
index fc62394..950a80f 100644
--- a/cli/lmi/shell/LMICIMXMLClient.py
+++ b/cli/lmi/shell/LMICIMXMLClient.py
@@ -27,8 +27,8 @@ from lmi.shell.LMIUtil import lmi_set_use_exceptions
from lmi.shell.LMIUtil import lmi_instance_to_path
from lmi.shell.LMIUtil import lmi_is_localhost
-from lmi.shell.LMIDecorators import lmi_process_cim_exceptions
-from lmi.shell.LMIDecorators import lmi_process_cim_exceptions_rval
+from lmi.shell.LMIDecorators import lmi_wrap_cim_exceptions
+from lmi.shell.LMIDecorators import lmi_wrap_cim_exceptions_rval
from lmi.shell.LMIExceptions import CIMError
from lmi.shell.LMIExceptions import ConnectionError
@@ -119,7 +119,7 @@ class LMICIMXMLClient(object):
self.disconnect()
del self._cliconn
- @lmi_process_cim_exceptions(False)
+ @lmi_wrap_cim_exceptions(False)
def connect(self):
"""
Connects to CIMOM.
@@ -172,7 +172,6 @@ class LMICIMXMLClient(object):
# NOTE: usage with Key=something, Value=something is deprecated
# NOTE: inst_filter is either None or dict
- @lmi_process_cim_exceptions()
def get_instance_names(self, classname, namespace=None, inst_filter=None,
limit=-1, **kwargs):
"""
@@ -198,6 +197,12 @@ class LMICIMXMLClient(object):
:raises: :py:exc:`.LMIFilterError`, :py:exc:`.CIMError`,
:py:exc:`.ConnectionError`
"""
+ @lmi_wrap_cim_exceptions(prefix="EnumerateInstanceNames " + classname)
+ def get_instance_names_core(classname, namespace):
+ return LMIReturnValue(
+ rval=self._cliconn.EnumerateInstanceNames(
+ classname, namespace))
+
filter_value = ""
filter_key = "Name"
if inst_filter is None:
@@ -217,7 +222,7 @@ class LMICIMXMLClient(object):
if filter_value:
inst_filter[filter_key] = filter_value
try:
- inst_name_list = self._cliconn.EnumerateInstanceNames(
+ inst_name_list, _, errorstr = get_instance_names_core(
classname, namespace)
if inst_filter:
inst_name_list_filtered = []
@@ -234,9 +239,8 @@ class LMICIMXMLClient(object):
errorstr = "Can not filter by '%s'" % filter_key
lmi_raise_or_dump_exception(LMIFilterError(errorstr))
return LMIReturnValue(rval=None, errorstr=errorstr)
- return LMIReturnValue(rval=inst_name_list)
+ return LMIReturnValue(rval=inst_name_list, errorstr=errorstr)
- @lmi_process_cim_exceptions()
def get_instance(self, instance, LocalOnly=True, IncludeQualifiers=False,
IncludeClassOrigin=False, PropertyList=None):
"""
@@ -275,18 +279,21 @@ class LMICIMXMLClient(object):
:raises: :py:exc:`.CIMError`, :py:exc:`.ConnectionError`,
:py:exc:`TypeError`
"""
- return LMIReturnValue(
- rval=self._cliconn.GetInstance(
- lmi_instance_to_path(instance),
- **filter_kwargs(
- LocalOnly=LocalOnly,
- IncludeQualifiers=IncludeQualifiers,
- IncludeClassOrigin=IncludeClassOrigin,
- PropertyList=PropertyList)))
+ @lmi_wrap_cim_exceptions(prefix="GetInstance " + instance.classname)
+ def get_instance_core(path, **kwargs):
+ return LMIReturnValue(
+ rval=self._cliconn.GetInstance(path, **kwargs))
+
+ return get_instance_core(
+ lmi_instance_to_path(instance),
+ **filter_kwargs(
+ LocalOnly=LocalOnly,
+ IncludeQualifiers=IncludeQualifiers,
+ IncludeClassOrigin=IncludeClassOrigin,
+ PropertyList=PropertyList))
# NOTE: usage with Key=something, Value=something is deprecated
# NOTE: inst_filter is either None or dict
- @lmi_process_cim_exceptions()
def get_instances(self, classname, namespace=None, inst_filter=None,
client_filtering=False, limit=-1, **kwargs):
"""
@@ -314,6 +321,12 @@ class LMICIMXMLClient(object):
corresponding error string.
:raises: :py:exc:`.CIMError`, :py:exc:`.ConnectionError`
"""
+ @lmi_wrap_cim_exceptions([], prefix="EnumerateInstances " + classname)
+ def get_instances_core(classname, namespace, **kwargs):
+ return LMIReturnValue(
+ rval=self._cliconn.EnumerateInstances(
+ classname, namespace, **kwargs))
+
filter_value = ""
filter_key = "Name"
if inst_filter is None:
@@ -348,16 +361,13 @@ class LMICIMXMLClient(object):
else:
query += " %s" % filter_value
more = True
- inst_list, _, errorstr = self.exec_query(
+ return self.exec_query(
LMICIMXMLClient.QUERY_LANG_WQL, query, namespace)
- if inst_list is None:
- return LMIReturnValue(rval=None, errorstr=errorstr)
- return LMIReturnValue(rval=inst_list)
# Client-side filtering - this is not a pretty solution, but it needs
# to be present due to TOG-Pegasus, which does not raise an exception,
# if an error occurs while performing CQL/WQL query.
- inst_list = self._cliconn.EnumerateInstances(
+ inst_list, _, errorstr = get_instances_core(
classname,
namespace,
LocalOnly=False,
@@ -374,9 +384,9 @@ class LMICIMXMLClient(object):
else:
inst_list_filtered.append(inst)
inst_list = inst_list_filtered
- return LMIReturnValue(rval=inst_list)
+ return LMIReturnValue(rval=inst_list, errorstr=errorstr)
- @lmi_process_cim_exceptions()
+ @lmi_wrap_cim_exceptions(prefix="EnumerateClassNames")
def get_class_names(self, namespace=None, ClassName=None,
DeepInheritance=False):
"""
@@ -404,7 +414,7 @@ class LMICIMXMLClient(object):
ClassName=ClassName,
DeepInheritance=DeepInheritance)))
- @lmi_process_cim_exceptions()
+ @lmi_wrap_cim_exceptions(prefix="GetClass")
def get_class(self, classname, namespace=None, LocalOnly=True,
IncludeQualifiers=True, IncludeClassOrigin=False,
PropertyList=None):
@@ -468,7 +478,6 @@ class LMICIMXMLClient(object):
rval=None, rparams=rparams, errorstr=errorstr)
return LMIReturnValue(rval=minimal_class.superclass)
- @lmi_process_cim_exceptions(-1)
def call_method(self, instance, method, **params):
"""
Executes a method within a given instance.
@@ -490,11 +499,15 @@ class LMICIMXMLClient(object):
:raises: :py:exc:`.CIMError`, :py:exc:`.ConnectionError`,
:py:exc:`TypeError`
"""
+ @lmi_wrap_cim_exceptions(-1, prefix="InvokeMethod " + method)
+ def call_method_core(path, method, **params):
+ rval, rparams = self._cliconn.InvokeMethod(method, path, **params)
+ return LMIReturnValue(rval=rval, rparams=rparams)
+
path = lmi_instance_to_path(instance)
- rval, rparams = self._cliconn.InvokeMethod(method, path, **params)
- return LMIReturnValue(rval=rval, rparams=rparams)
+ return call_method_core(path, method, **params)
- @lmi_process_cim_exceptions_rval([])
+ @lmi_wrap_cim_exceptions_rval([], prefix="AssociatorNames")
def get_associator_names(self, instance, AssocClass=None, ResultClass=None,
Role=None, ResultRole=None, limit=-1):
"""
@@ -549,7 +562,7 @@ class LMICIMXMLClient(object):
Role=Role,
ResultRole=ResultRole))
- @lmi_process_cim_exceptions_rval([])
+ @lmi_wrap_cim_exceptions_rval([], prefix="Associators")
def get_associators(self, instance, AssocClass=None, ResultClass=None,
Role=None, ResultRole=None, IncludeQualifiers=False,
IncludeClassOrigin=False, PropertyList=None,
@@ -617,7 +630,7 @@ class LMICIMXMLClient(object):
IncludeClassOrigin=IncludeClassOrigin,
PropertyList=PropertyList))
- @lmi_process_cim_exceptions_rval([])
+ @lmi_wrap_cim_exceptions_rval([], prefix="ReferenceNames")
def get_reference_names(self, instance, ResultClass=None, Role=None,
limit=-1):
"""
@@ -655,7 +668,7 @@ class LMICIMXMLClient(object):
ResultClass=ResultClass,
Role=Role))
- @lmi_process_cim_exceptions_rval([])
+ @lmi_wrap_cim_exceptions_rval([], prefix="References")
def get_references(self, instance, ResultClass=None, Role=None,
IncludeQualifiers=False, IncludeClassOrigin=False,
PropertyList=None, limit=-1):
@@ -709,7 +722,7 @@ class LMICIMXMLClient(object):
IncludeClassOrigin=IncludeClassOrigin,
PropertyList=PropertyList))
- @lmi_process_cim_exceptions(None)
+ @lmi_wrap_cim_exceptions(None, prefix="CreateInstance")
def create_instance(self, classname, namespace=None, host=None,
properties=None, qualifiers=None, property_list=None):
"""
@@ -741,7 +754,7 @@ class LMICIMXMLClient(object):
cim_path = self._cliconn.CreateInstance(NewInstance=cim_instance)
return self.get_instance(cim_path, LocalOnly=False)
- @lmi_process_cim_exceptions(-1)
+ @lmi_wrap_cim_exceptions(-1, prefix="ModifyInstance")
def modify_instance(self, instance, IncludeQualifiers=True,
PropertyList=None):
"""
@@ -770,7 +783,7 @@ class LMICIMXMLClient(object):
PropertyList=PropertyList))
return LMIReturnValue(rval=0)
- @lmi_process_cim_exceptions(False)
+ @lmi_wrap_cim_exceptions(False, prefix="DeleteInstance")
def delete_instance(self, instance):
"""
Deletes a :py:class:`wbem.CIMInstance` from the CIMOM side.
@@ -792,7 +805,7 @@ class LMICIMXMLClient(object):
self._cliconn.DeleteInstance(lmi_instance_to_path(instance))
return LMIReturnValue(rval=True)
- @lmi_process_cim_exceptions()
+ @lmi_wrap_cim_exceptions(prefix="ExecQuery")
def exec_query(self, query_lang, query, namespace=None):
"""
Executes a query and returns a list of :py:class:`wbem.CIMInstance`
diff --git a/cli/lmi/shell/LMIClass.py b/cli/lmi/shell/LMIClass.py
index 4d800ee..83efb37 100644
--- a/cli/lmi/shell/LMIClass.py
+++ b/cli/lmi/shell/LMIClass.py
@@ -25,7 +25,7 @@ from lmi.shell.LMIObjectFactory import LMIObjectFactory
from lmi.shell.LMIExceptions import LMIUnknownPropertyError
from lmi.shell.LMIDecorators import lmi_class_fetch_lazy
-from lmi.shell.LMIDecorators import lmi_process_cim_exceptions
+from lmi.shell.LMIDecorators import lmi_wrap_cim_exceptions_rval
from lmi.shell.LMIDecorators import lmi_return_val_if_fail
from lmi.shell.LMIDecorators import lmi_return_if_fail
@@ -157,9 +157,7 @@ class LMIClass(LMIWrapperBaseObject):
return bool(self._cim_class) and \
(not full_fetch or self._cim_class_full_fetch)
- @lmi_process_cim_exceptions(
- lambda x, y: None,
- lambda x, y: None)
+ @lmi_wrap_cim_exceptions_rval(None)
def fetch(self, full_fetch=False):
"""
Manually fetches a wrapped :py:class:`wbem.CIMClass` object.
diff --git a/cli/lmi/shell/LMIDecorators.py b/cli/lmi/shell/LMIDecorators.py
index 8be5694..d99eb3d 100644
--- a/cli/lmi/shell/LMIDecorators.py
+++ b/cli/lmi/shell/LMIDecorators.py
@@ -283,27 +283,25 @@ class lmi_instance_name_fetch_lazy(object):
return fn(self_wr, *args, **kwargs)
return wrapped
-# Default lmi_process_cim_exceptions error handler
-def return_lmi_rval(rval, exc):
- errorstr = exc.args[1] if len(exc.args) > 1 else exc.args[0]
- return LMIReturnValue(rval=rval, errorstr=errorstr)
-
-class lmi_process_cim_exceptions(object):
+class lmi_wrap_cim_exceptions(object):
"""
- Decorator used for CIM-XML exception processing.
+ Decorator used for CIM-XML exception wrapping.
:param rval: rval passed to :py:meth:`.LMIReturnValue.__init__`
:param error_callable: callable used for processing
:py:exc:`wbem.CIMError` and :py:exc:`.ConnectionError`
+ :param str prefix: string prefix for wrapped exception's args
**NOTE:** callables need to take 2 arguments: return value and error
string.
"""
- def __init__(self, rval=None, error_callable=return_lmi_rval):
+ def __init__(self, rval=None, error_callable=None, prefix=""):
self._rval = rval
- self._error_callable = error_callable
+ self._error_callable = self.default_error_callable \
+ if error_callable is None else error_callable
+ self._prefix = prefix
def __call__(self, fn):
"""
@@ -317,72 +315,75 @@ class lmi_process_cim_exceptions(object):
try:
rval = fn(*args, **kwargs)
except wbem.CIMError, e:
- lmi_raise_or_dump_exception(CIMError(e))
- return self._error_callable(self._rval, e)
+ cim_error = self.make_cim_error(e)
+ lmi_raise_or_dump_exception(cim_error)
+ return self._error_callable(self._rval, cim_error)
except wbem.ConnectionError, e:
- lmi_raise_or_dump_exception(ConnectionError(e))
- return self._error_callable(self._rval, e)
+ conn_error = self.make_connection_error(e)
+ lmi_raise_or_dump_exception(conn_error)
+ return self._error_callable(self._rval, conn_error)
except wbem.AuthError, e:
# PyWBEM's AuthError does not have HTTP error code in the
# exception args. We add the code by hand.
- e = ConnectionError(401, "Unauthorized")
- lmi_raise_or_dump_exception(e)
- return self._error_callable(self._rval, e)
+ conn_error = ConnectionError(401, self.make_prefix() +
"Unauthorized")
+ lmi_raise_or_dump_exception(conn_error)
+ return self._error_callable(self._rval, conn_error)
return rval
return wrapped
+ @staticmethod
+ def default_error_callable(rval, exc):
+ """
+ Default exception handler, which translates exception into
+ :py:class:`.LMIReturnValue`.
+ """
+ errorstr = exc.args[1] if len(exc.args) > 1 else exc.args[0]
+ return LMIReturnValue(rval=rval, errorstr=errorstr)
-class lmi_process_cim_exceptions_rval(lmi_process_cim_exceptions):
- """
- Decorator used for CIM-XML exception processing.
-
- :param rval: return value of a decorated method in case of exception
- """
- def __init__(self, rval=None):
- super(lmi_process_cim_exceptions_rval, self).__init__(
- rval, lambda r, e: r)
-
+ def make_prefix(self):
+ """
+ Returns prefix string for a CIM exception.
+ """
+ if not self._prefix:
+ return ""
+ return self._prefix + ": "
-class lmi_process_wsman_exceptions(object):
- """
- Decorator used for wsman exception processing.
+ def make_exception_args(self, exc, prefix):
+ """
+ Returns a list of exception arguments. String argument is prefixed by
+ :py:meth:`make_prefix`.
+ """
+ def prefix_arg(arg):
+ if isinstance(arg, basestring):
+ return self.make_prefix() + arg
+ else:
+ return arg
- :param rval: rval passed to :py:meth:`.LMIReturnValue.__init__`
- :param error_callable: callable used for processing
- :py:exc:`wbem.CIMError` and :py:exc:`.ConnectionError`
+ return [prefix_arg(arg) for arg in exc.args]
- **NOTE:** callables need to take 2 arguments: return value and error
- string.
- """
- def __init__(self, rval=None, error_callable=return_lmi_rval):
- self._rval = rval
- self._error_callable = error_callable
-
- def __call__(self, fn):
+ def make_cim_error(self, cim_error):
"""
- Execute a wrapped method.
+ Returns wrapped CIMError from wbem.CIMError.
+ """
+ return CIMError(
+ *self.make_exception_args(
+ cim_error, self.make_prefix()))
- :param instancemethod fn: decorated method
- :raises: :py:exc:`.CIMError`
+ def make_connection_error(self, conn_error):
"""
- @wraps(fn)
- def wrapped(*args, **kwargs):
- try:
- rval = fn(*args, **kwargs)
- except wbem.CIMError, e:
- x = CIMError(e)
- lmi_raise_or_dump_exception(CIMError(e))
- return self._error_callable(self._rval, e)
- return rval
- return wrapped
+ Returns wrapped ConnectionError from wbem.ConnectionError.
+ """
+ return ConnectionError(
+ *self.make_exception_args(
+ conn_error, self.make_prefix()))
-class lmi_process_wsman_exceptions_rval(lmi_process_wsman_exceptions):
+class lmi_wrap_cim_exceptions_rval(lmi_wrap_cim_exceptions):
"""
- Decorator used for wsman exception processing.
+ Decorator used for CIM-XML exception wrapping.
:param rval: return value of a decorated method in case of exception
"""
- def __init__(self, rval=None):
- super(lmi_process_wsman_exceptions_rval, self).__init__(
- rval, lambda r, e: r)
+ def __init__(self, rval=None, prefix=""):
+ super(lmi_wrap_cim_exceptions_rval, self).__init__(
+ rval, lambda r, e: r, prefix)
diff --git a/cli/lmi/shell/LMIWSMANClient.py b/cli/lmi/shell/LMIWSMANClient.py
index c506dd2..cfa794c 100644
--- a/cli/lmi/shell/LMIWSMANClient.py
+++ b/cli/lmi/shell/LMIWSMANClient.py
@@ -18,8 +18,8 @@ import types
from lmi.shell.compat import *
-from lmi.shell.LMIDecorators import lmi_process_wsman_exceptions
-from lmi.shell.LMIDecorators import lmi_process_wsman_exceptions_rval
+from lmi.shell.LMIDecorators import lmi_wrap_cim_exceptions
+from lmi.shell.LMIDecorators import lmi_wrap_cim_exceptions_rval
from lmi.shell.LMIExceptions import CIMError
from lmi.shell.LMIExceptions import LMINotSupported
@@ -622,7 +622,6 @@ class LMIWSMANClient(object):
# NOTE: usage with Key=something, Value=something is deprecated
# NOTE: inst_filter is either None or dict
- @lmi_process_wsman_exceptions()
def get_instance_names(self, classname, namespace=None, inst_filter=None,
limit=-1, **kwargs):
"""
@@ -647,14 +646,17 @@ class LMIWSMANClient(object):
appropriate error string
:raises: :py:exc:`.CIMError`
"""
- inst_names_list = self.enumerate(
- LMIWSMANClient.RES_INSTANCE_NAME, classname, namespace,
- inst_filter, limit, **kwargs)
- return LMIReturnValue(rval=inst_names_list)
+ @lmi_wrap_cim_exceptions(prefix="EnumerateInstanceNames " + classname)
+ def get_instance_names_core():
+ inst_names_list = self.enumerate(
+ LMIWSMANClient.RES_INSTANCE_NAME, classname, namespace,
+ inst_filter, limit, **kwargs)
+ return LMIReturnValue(rval=inst_names_list)
+ return get_instance_names_core()
# NOTE: usage with Key=something, Value=something is deprecated
# NOTE: inst_filter is either None or dict
- @lmi_process_wsman_exceptions()
+ @lmi_wrap_cim_exceptions(prefix="EnumerateInstances")
def get_instances(self, classname, namespace=None, inst_filter=None,
client_filtering=False, limit=-1, **kwargs):
"""
@@ -685,9 +687,10 @@ class LMIWSMANClient(object):
# We do not enumerate instances directly. First instance names are
# pulled from CIMOM. This is done due to lack of keybindings
# information in the pull response of the instance.
- inst_names_list = self.enumerate(
- LMIWSMANClient.RES_INSTANCE_NAME, classname, namespace,
- inst_filter, limit, **kwargs)
+ inst_names_list, _, errorstr = self.get_instance_names(
+ classname, namespace, inst_filter, limit, **kwargs)
+ if not inst_names_list:
+ return LMIReturnValue(rval=None, errorstr=errorstr)
# Get all the instances from instance names. Now we can construct
# LMIInstance also with object path information.
@@ -710,9 +713,8 @@ class LMIWSMANClient(object):
inst_list_filtered.append(inst)
inst_list = inst_list_filtered
- return LMIReturnValue(rval=inst_list)
+ return LMIReturnValue(rval=inst_list, errorstr=errorstr)
- @lmi_process_wsman_exceptions()
def get_instance(self, instance, LocalOnly=True, IncludeQualifiers=False,
IncludeClassOrigin=False, PropertyList=None):
"""
@@ -735,6 +737,16 @@ class LMIWSMANClient(object):
``errorstr`` is set to corresponding error string
:raises: :py:exc:`.CIMError`
"""
+ @lmi_wrap_cim_exceptions(prefix="GetInstance " + instance.classname)
+ def get_instance_core(path, options):
+ uri = self._cls_ns_to_uri(path.classname, path.namespace)
+ doc = self._cliconn.get(options, uri)
+ self._xml_check_response(doc)
+ inst = self._xml_to_wbem_instance(
+ doc.body().child(), path.namespace, self._cliconn.host())
+ inst.path = path
+ return LMIReturnValue(rval=inst)
+
path = lmi_instance_to_path(instance)
options = pywsman.ClientOptions()
@@ -744,16 +756,8 @@ class LMIWSMANClient(object):
else:
value = str(v)
options.add_selector(k, value)
- uri = self._cls_ns_to_uri(path.classname, path.namespace)
- doc = self._cliconn.get(options, uri)
- self._xml_check_response(doc)
-
- inst = self._xml_to_wbem_instance(
- doc.body().child(), path.namespace, self._cliconn.host())
- # Adjust CIM Object Path by hand
- inst.path = path
- return LMIReturnValue(rval=inst)
+ return get_instance_core(path, options)
def get_class_names(self, *args, **kwargs):
"""
@@ -777,7 +781,6 @@ class LMIWSMANClient(object):
return LMIReturnValue(
rval=None, errorstr="GetSuperClass() not supported")
- @lmi_process_wsman_exceptions(-1)
def call_method(self, instance, method, **params):
"""
Executes a method within a given instance.
@@ -798,26 +801,29 @@ class LMIWSMANClient(object):
and errorstr to appropriate error string
:raises: :py:exc:`.CIMError`
"""
+ @lmi_wrap_cim_exceptions(-1, prefix="InvokeMethod " + method)
+ def call_method_core(method, path, options):
+ uri = self._cls_ns_to_uri(path.classname, path.namespace)
+ doc = self._cliconn.invoke(options, uri, method)
+ self._xml_check_response(doc)
+ method_doc = doc.body().get(method + "_OUTPUT")
+ return self._xml_invoke_rval(
+ method_doc, path.namespace, self._cliconn.host())
+
path = lmi_instance_to_path(instance)
options = pywsman.ClientOptions()
for k, v in path.keybindings.iteritems():
options.add_selector(k, str(v))
- uri = self._cls_ns_to_uri(path.classname, path.namespace)
# Add method parameters
for k, v in params.iteritems():
options.add_property(k, str(v))
# Invoke the method
- doc = self._cliconn.invoke(options, uri, method)
- self._xml_check_response(doc)
-
- method_doc = doc.body().get(method + "_OUTPUT")
- return self._xml_invoke_rval(
- method_doc, path.namespace, self._cliconn.host())
+ return call_method_core(method, path, options)
- @lmi_process_wsman_exceptions_rval([])
+ @lmi_wrap_cim_exceptions_rval([], prefix="AssociatorNames")
def get_associator_names(self, instance, AssocClass=None, ResultClass=None,
Role=None, ResultRole=None, limit=-1):
"""
@@ -868,7 +874,7 @@ class LMIWSMANClient(object):
LMIWSMANClient.RES_INSTANCE_NAME, AssocClass, ResultClass, Role,
ResultRole, limit)
- @lmi_process_wsman_exceptions_rval([])
+ @lmi_wrap_cim_exceptions_rval([], prefix="Associators")
def get_associators(self, instance, AssocClass=None, ResultClass=None,
Role=None, ResultRole=None, IncludeQualifiers=False,
IncludeClassOrigin=False, PropertyList=None, limit=-1):
@@ -923,7 +929,7 @@ class LMIWSMANClient(object):
LMIWSMANClient.RES_INSTANCE, AssocClass,
ResultClass, Role, ResultRole, limit)
- @lmi_process_wsman_exceptions_rval([])
+ @lmi_wrap_cim_exceptions_rval([], prefix="ReferenceNames")
def get_reference_names(self, instance, ResultClass=None, Role=None,
limit=-1):
"""
@@ -959,7 +965,7 @@ class LMIWSMANClient(object):
LMIWSMANClient.RES_INSTANCE_NAME, None,
ResultClass, Role, None, limit)
- @lmi_process_wsman_exceptions_rval([])
+ @lmi_wrap_cim_exceptions_rval([], prefix="References")
def get_references(self, instance, ResultClass=None, Role=None,
IncludeQualifiers=False, IncludeClassOrigin=False,
PropertyList=None, limit=-1):
@@ -1022,7 +1028,7 @@ class LMIWSMANClient(object):
return LMIReturnValue(
rval=False, errorstr="DeleteInstance() not supported")
- @lmi_process_wsman_exceptions()
+ @lmi_wrap_cim_exceptions(prefix="ExecQuery")
def exec_query(self, query_lang, query, namespace=wbem.DEFAULT_NAMESPACE):
"""
Executes a query and returns a list of :py:class:`wbem.CIMInstance`