Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
>---------------------------------------------------------------
commit 97e7188e0beb78f455bc9df49c154af135b0f7e3
Author: Peter Hatina <phatina(a)redhat.com>
Date: Tue Jul 15 15:01:18 2014 +0200
raise CIMError when synchronous method call fails
>---------------------------------------------------------------
cli/lmi/shell/LMIMethod.py | 25 ++++++++++++++++++++-----
1 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/cli/lmi/shell/LMIMethod.py b/cli/lmi/shell/LMIMethod.py
index f82641f..3aea5d6 100644
--- a/cli/lmi/shell/LMIMethod.py
+++ b/cli/lmi/shell/LMIMethod.py
@@ -43,6 +43,7 @@ from lmi.shell.LMIJob import JOB_FINISH_DELAYED
from lmi.shell.LMIJob import JOB_FINISH_EARLY
from lmi.shell.LMIUtil import LMIPassByRef
+from lmi.shell.LMIUtil import lmi_get_use_exceptions
from lmi.shell.LMIUtil import lmi_raise_or_dump_exception
from lmi.shell.LMIUtil import lmi_transform_to_cim_param
from lmi.shell.LMIUtil import lmi_transform_to_lmi
@@ -219,6 +220,16 @@ class LMIMethod(LMIWrapperBaseObject):
:returns: :py:class:`.LMIReturnValue` object with ``rval`` set to Job
output parameters
"""
+ def get_rval_errorstr(err_list):
+ for err in err_list:
+ if err.CIMStatusCode is not None:
+ return err.CIMStatusCode, err.Message
+ # There is no CIM_Error instance with CIMStatusCode set. In such
+ # case, we set rval to CIM_ERR_FAILED and for error message we use
+ # the first instance from err_list.
+ message = err_list[0].Message if err_list else "Failed"
+ return wbem.CIM_ERR_FAILED, message
+
# Adjust return value from the job object.
if job_refresh:
job_inst.refresh()
@@ -246,15 +257,19 @@ class LMIMethod(LMIWrapperBaseObject):
"Sync%s: Job instance can not be refreshed; %s" %
(self._method_name, errorstr))
raise LMISynchroMethodCallError(errorstr)
- exc_rval, exc_rparams, exc_errorstr = job_inst.GetError()
- error_inst = exc_rparams.get("error", None)
- if not error_inst:
+ exc_rval, exc_rparams, exc_errorstr = job_inst.GetErrors()
+ err_list = exc_rparams.get("errors", None)
+ if not err_list:
logger.debug(
- "Sync%s: Can not retrieve Error instance; %s" %
+ "Sync%s: Can not retrieve Error instances; %s" %
(self._method_name, exc_errorstr))
raise LMISynchroMethodCallError(
"Could not get Job error message")
- errorstr = error_inst.Message
+
+ rval, errorstr = get_rval_errorstr(err_list)
+ if lmi_get_use_exceptions():
+ raise CIMError(rval, errorstr)
+
return LMIReturnValue(rval=rval, rparams=rparams, errorstr=errorstr)
def __handle_synchro_method_call_indication(self, job_inst):
Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
>---------------------------------------------------------------
commit 3b737805d9dc1203d603394de3f6e05e2601f598
Author: Peter Hatina <phatina(a)redhat.com>
Date: Tue Jul 15 10:35:03 2014 +0200
revert return type of LMICIMXMLClient::modify_instance()
bool -> int
>---------------------------------------------------------------
cli/lmi/shell/LMICIMXMLClient.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/cli/lmi/shell/LMICIMXMLClient.py b/cli/lmi/shell/LMICIMXMLClient.py
index a7c24c0..4cd9d5a 100644
--- a/cli/lmi/shell/LMICIMXMLClient.py
+++ b/cli/lmi/shell/LMICIMXMLClient.py
@@ -741,7 +741,7 @@ class LMICIMXMLClient(object):
cim_path = self._cliconn.CreateInstance(NewInstance=cim_instance)
return self.get_instance(cim_path, LocalOnly=False)
- @lmi_process_cim_exceptions(False)
+ @lmi_process_cim_exceptions(-1)
def modify_instance(self, instance, IncludeQualifiers=True,
PropertyList=None):
"""
@@ -758,8 +758,8 @@ class LMICIMXMLClient(object):
PropertyList is None, the set of properties to be modified consists
of those of *ModifiedInstance* with values different from the
current values in the instance to be modified.
- :returns: :py:class:`.LMIReturnValue` object with ``rval`` set to True,
- if no error occurs; otherwise ``rval`` is set to False and
+ :returns: :py:class:`.LMIReturnValue` object with ``rval`` set to 0,
+ if no error occurs; otherwise ``rval`` is set to -1 and
``errorstr`` is set to corresponding error string.
:raises: :py:exc:`.CIMError`, :py:exc:`.ConnectionError`
"""
@@ -768,7 +768,7 @@ class LMICIMXMLClient(object):
**filter_kwargs(
IncludeQualifiers=IncludeQualifiers,
PropertyList=PropertyList))
- return LMIReturnValue(rval=True)
+ return LMIReturnValue(rval=0)
@lmi_process_cim_exceptions(False)
def delete_instance(self, instance):
Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
>---------------------------------------------------------------
commit c5580132b078a317863d4059f58078fee8726708
Author: Peter Hatina <phatina(a)redhat.com>
Date: Fri Jul 11 14:37:49 2014 +0200
drop double doc-string in LMIClass::fetch()
>---------------------------------------------------------------
cli/lmi/shell/LMIClass.py | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/cli/lmi/shell/LMIClass.py b/cli/lmi/shell/LMIClass.py
index 62b0d3a..4d800ee 100644
--- a/cli/lmi/shell/LMIClass.py
+++ b/cli/lmi/shell/LMIClass.py
@@ -168,10 +168,6 @@ class LMIClass(LMIWrapperBaseObject):
include qualifiers and class origin. Default value is False.
:raises: :py:exc:`.CIMError`, :py:exc:`.ConnectionError`
- :param bool full_fetch: True, if :py:class:`CIMClass` should include qualifiers
- and class origin. Default value is False.
- :raises: :py:exc:`pywbem.CIMError`, :py:exc:`pywbem.AuthError`
-
**Usage:** See :ref:`class_fetching_a_class`.
"""
if self._conn.is_wsman():
Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : openlmi-tools-lmiwbem
>---------------------------------------------------------------
commit b920799972c6077ee7f3d045b963fde1fa95cbeb
Author: Peter Hatina <phatina(a)redhat.com>
Date: Fri Jul 11 14:10:39 2014 +0200
revert version to 0.9.2
>---------------------------------------------------------------
cli/lmi/shell/LMIShellVersion.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/cli/lmi/shell/LMIShellVersion.py b/cli/lmi/shell/LMIShellVersion.py
index 02d4333..6df2b4e 100644
--- a/cli/lmi/shell/LMIShellVersion.py
+++ b/cli/lmi/shell/LMIShellVersion.py
@@ -13,4 +13,4 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
-__version__ = "1.0.0"
+__version__ = "0.9.2"
Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : openlmi-tools-lmiwbem
>---------------------------------------------------------------
commit 7cabefea1fbaf38a087851a0fbb6d801502a3e2b
Author: Peter Hatina <phatina(a)redhat.com>
Date: Fri Jul 11 11:56:01 2014 +0200
fix method name, when sync prefix is present
>---------------------------------------------------------------
cli/lmi/shell/LMIMethod.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cli/lmi/shell/LMIMethod.py b/cli/lmi/shell/LMIMethod.py
index 9aabec2..ddeb843 100644
--- a/cli/lmi/shell/LMIMethod.py
+++ b/cli/lmi/shell/LMIMethod.py
@@ -185,12 +185,12 @@ class LMIMethod(LMIWrapperBaseObject):
if is_sync:
# Store the synchronous flag and trim the method name
self._sync_method = True
- method_name = method_name[4:]
+ self._method_name = method_name[4:]
# We need to have CIMClass with qualifiers. Fetch full class.
lmi_class = self._lmi_instance._lmi_class
lmi_class.fetch(True)
- self._method = lmi_class._cim_class.methods[method_name]
+ self._method = lmi_class._cim_class.methods[self._method_name]
# Store the constant values as a list. This can consume some time, if
# computed on demand.