Repository :
http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
---------------------------------------------------------------
commit 67560c6db7861f2094b7e0d8639714e2fb9907a9
Author: Michal Minar <miminar(a)redhat.com>
Date: Thu Jul 17 15:37:18 2014 +0200
shell: better handle job output parameters
Due to openlmi's workaround of pegasus' shortcoming, JobOutParameters
property of job instance is something else then it should be. It's an
instance of __MethodParameters_<method\_name\>_Result class which derives
from __MethodParameters_<method\_name\> class. The latter contains input
parameters of asynchronous method. Therefor JobOutParameters may contain
input parameters as well. Let's filter them out because this may confuse
client scripts.
---------------------------------------------------------------
cli/lmi/shell/LMIMethod.py | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/cli/lmi/shell/LMIMethod.py b/cli/lmi/shell/LMIMethod.py
index 885f251..b30d265 100644
--- a/cli/lmi/shell/LMIMethod.py
+++ b/cli/lmi/shell/LMIMethod.py
@@ -252,9 +252,17 @@ class LMIMethod(LMIWrapperBaseObject):
rparams = wbem.NocaseDict()
if job_inst.JobOutParameters is not None:
props = job_inst.JobOutParameters.properties
- rparams = wbem.NocaseDict(
- dict((k, x.value) for k, x in props.iteritems()))
- rval = rparams.pop("__ReturnValue")
+ rparams = wbem.NocaseDict()
+ for name, prop in props.iteritems():
+ # Return just those properties of given class that are listed
+ # as output parameters of particular method.
+ if self._method.parameters.has_key(name) \
+ and (self._method.parameters[name].qualifiers is None \
+ or self._method.parameters[name].qualifiers.get(
+ 'Out', False)):
+ rparams[name] = prop.value
+ elif name == '__ReturnValue':
+ rval = prop.value
errorstr = ""
# Is job in exception state? If so, adjust corresponding error string