Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
>---------------------------------------------------------------
commit 7a003bf6fea8391883c461a05342bdc6d21ae2c1
Author: Peter Hatina <phatina(a)redhat.com>
Date: Wed Feb 13 15:54:28 2013 +0100
switch to pywbem.EnumerateInstances() in LmiBaseClient::_get_instances()
../test/
>---------------------------------------------------------------
cli-tools/lmi/lmi_client_base.py | 23 ++++++-----------------
1 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/cli-tools/lmi/lmi_client_base.py b/cli-tools/lmi/lmi_client_base.py
index 768875e..34aeafe 100644
--- a/cli-tools/lmi/lmi_client_base.py
+++ b/cli-tools/lmi/lmi_client_base.py
@@ -122,24 +122,13 @@ class LmiBaseClient(object):
if "Value" in kwargs:
filter_value = kwargs["Value"]
kwargs.pop("Value")
- (inst_name_list, rparams, errorstr) = self._get_instance_names(klass, **kwargs)
- if not inst_name_list:
- return LmiReturnValue(rval = None, rparams = {}, errorstr = errorstr)
- if filter_value:
- inst_name_list = filter(lambda n: not filter_key in n or n[filter_key] == filter_value, inst_name_list)
+ try:
+ inst_list_not_filtered = self._cliconn.EnumerateInstances(klass, **kwargs)
+ except pywbem.cim_operations.CIMError, e:
+ raise_or_dump_exception(e)
+ return LmiReturnValue(rval = None, rparams = {}, errorstr = e.args[1])
inst_list = []
- for i in inst_name_list:
- try:
- inst = self._cliconn.GetInstance(InstanceName=i, LocalOnly = False)
- except pywbem.cim_operations.CIMError, e:
- raise_or_dump_exception(e)
- # we can get this error for eg. Linux_UnixProcess instances
- # when, there the process exited earlier than this method
- if e.args[0] == pywbem.CIM_ERR_NOT_FOUND:
- # what is right, skip non existing object, or drop the whole list?
- continue
- else:
- return LmiReturnValue(rval = None, rparams = {}, errorstr = e.args[1])
+ for inst in inst_list_not_filtered:
if not filter_value or filter_key in inst and inst[filter_key] == filter_value:
inst_list.append(inst)
if not inst_list: