[openlmi-scripts/f20] support older OpenLMI Hardware providers

Michal Minar miminar at fedoraproject.org
Tue Feb 25 06:50:49 UTC 2014


commit 353cc7558c3538f5b94880db2fa8d9553ca2bef3
Author: Michal Minar <miminar at redhat.com>
Date:   Tue Feb 25 07:50:56 2014 +0100

    support older OpenLMI Hardware providers
    
    Resolves: bz#1069320

 ...ts-0.2.7-hardware_support_older_providers.patch |   39 ++++++++++++++++++++
 openlmi-scripts.spec                               |    9 ++++-
 2 files changed, 47 insertions(+), 1 deletions(-)
---
diff --git a/openlmi-scripts-0.2.7-hardware_support_older_providers.patch b/openlmi-scripts-0.2.7-hardware_support_older_providers.patch
new file mode 100644
index 0000000..1580f89
--- /dev/null
+++ b/openlmi-scripts-0.2.7-hardware_support_older_providers.patch
@@ -0,0 +1,39 @@
+diff --git a/commands/hardware/lmi/scripts/hardware/__init__.py b/commands/hardware/lmi/scripts/hardware/__init__.py
+index a110800..c077d70 100644
+--- a/commands/hardware/lmi/scripts/hardware/__init__.py
++++ b/commands/hardware/lmi/scripts/hardware/__init__.py
+@@ -32,6 +32,9 @@
+ LMI hardware provider client library.
+ """
+ 
++import pywbem
++
++from lmi.scripts.common import get_logger
+ from lmi.scripts.common import get_computer_system
+ 
+ GREEN_COLOR = 1
+@@ -42,6 +45,8 @@ EMPTY_LINE = ('', '')
+ # GLOBAL variable - modified in get_all_info(), accessed in init_result()
+ STANDALONE = True
+ 
++LOG = get_logger(__name__)
++
+ def _cache_replies(ns, class_name, method):
+     """
+     Get the reply from cimom and cache it. Cache is cleared
+@@ -83,7 +88,14 @@ def get_all_instances(ns, class_name):
+     :returns: List of instances of instance_name
+     :rtype: List of :py:class:`lmi.shell.LMIInstance`
+     """
+-    return _cache_replies(ns, class_name, 'instances')
++    try:
++        return _cache_replies(ns, class_name, 'instances')
++    except pywbem.CIMError as err:
++        if err.args[0] == pywbem.CIM_ERR_NOT_SUPPORTED:
++            LOG().info('System has old openlmi-hardware package installed,'
++                ' class "%s" is not available.', class_name)
++            return []
++        raise
+ 
+ def get_hostname(ns):
+     """
diff --git a/openlmi-scripts.spec b/openlmi-scripts.spec
index 8f37ff5..2f5c513 100644
--- a/openlmi-scripts.spec
+++ b/openlmi-scripts.spec
@@ -5,7 +5,7 @@
 
 Name:           openlmi-scripts
 Version:        %{openlmi_scripts_version}
-Release:        0%{?dist}
+Release:        1%{?dist}
 Summary:        Client-side python modules and command line utilities
 
 License:        BSD
@@ -26,6 +26,8 @@ Requires:       openlmi-python-base >= 0.3.0
 Requires:       python-docopt >= 0.6.1
 Requires:       openlmi-tools >= 0.9
 
+Patch0:         openlmi-scripts-0.2.7-hardware_support_older_providers.patch
+
 %description
 Client-side python modules and command line utilities.
 
@@ -103,6 +105,7 @@ system.
 
 %prep
 %setup -qn %{name}-%{commit}
+%patch0 -p1 -b .hardware_support_older_providers
 
 %build
 %{__python} setup.py build
@@ -205,6 +208,10 @@ install -m 644 README.md COPYING Changelog $RPM_BUILD_ROOT/%{_docdir}/%{name}
 %{python_sitelib}/openlmi_scripts_system-*
 
 %changelog
+* Tue Feb 25 2014 Michal Minar <miminar at redhat.com> 0.2.7-1
+- Support older OpenLMI Hardware providers.
+- Resolves: bz#1069320
+
 * Mon Feb 24 2014 Michal Minar <miminar at redhat.com> 0.2.7-0
 - New upstream version.
 - Added system library.


More information about the scm-commits mailing list