summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Minar <miminar@redhat.com>2013-02-04 13:42:25 +0100
committerMichal Minar <miminar@redhat.com>2013-02-04 14:51:03 +0100
commit3ad1feb54e489bffd2cb6ff2bf89a6669f1e4cdd (patch)
treee07ff0d10efd973050fbc63184f9edd75da6213c /src
parent775290a2c13b801c84fefdc4538fe110c4df6c24 (diff)
downloadopenlmi-providers-3ad1feb54e489bffd2cb6ff2bf89a6669f1e4cdd.tar.gz
openlmi-providers-3ad1feb54e489bffd2cb6ff2bf89a6669f1e4cdd.tar.xz
openlmi-providers-3ad1feb54e489bffd2cb6ff2bf89a6669f1e4cdd.zip
new subpackage openlmi.common created for sharing code
openlmi.common subpackage allows to share code accros various OpenLMI provider packages. Currently there is a cmpi_logging.py module. Resolves: #71 in openlmi trac -- Make common package under openlmi namespace for utilities shared accross python providers.
Diffstat (limited to 'src')
-rw-r--r--src/python/openlmi/common/__init__.py24
-rw-r--r--src/python/openlmi/common/cmpi_logging.py (renamed from src/software/openlmi/software/util/cmpi_logging.py)2
-rw-r--r--src/python/setup.py4
-rw-r--r--src/software/openlmi/software/LMI_SoftwareFileCheck.py4
-rw-r--r--src/software/openlmi/software/LMI_SoftwareInstalledPackage.py4
-rw-r--r--src/software/openlmi/software/LMI_SoftwarePackage.py2
-rw-r--r--src/software/openlmi/software/LMI_SoftwarePackageChecks.py4
-rw-r--r--src/software/openlmi/software/cimom_entry.py2
-rw-r--r--src/software/openlmi/software/core/SoftwareFileCheck.py2
-rw-r--r--src/software/openlmi/software/core/SoftwarePackage.py2
-rw-r--r--src/software/openlmi/software/yumdb/__init__.py2
11 files changed, 38 insertions, 14 deletions
diff --git a/src/python/openlmi/common/__init__.py b/src/python/openlmi/common/__init__.py
new file mode 100644
index 0000000..9acc604
--- /dev/null
+++ b/src/python/openlmi/common/__init__.py
@@ -0,0 +1,24 @@
+# Software Management Providers
+#
+# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Authors: Michal Minar <miminar@redhat.com>
+#
+
+"""
+Common utilities for OpenLMI python providers.
+"""
diff --git a/src/software/openlmi/software/util/cmpi_logging.py b/src/python/openlmi/common/cmpi_logging.py
index 2db14b6..aa9cd71 100644
--- a/src/software/openlmi/software/util/cmpi_logging.py
+++ b/src/python/openlmi/common/cmpi_logging.py
@@ -111,7 +111,7 @@ def trace_function(func):
logger.log(TRACE_VERBOSE, "traceback: %s",
traceback.format_exc())
exc.tb_printed = True
- logger.log(TRACE_WARNING, "%s.%s threw exception %s",
+ logger.log(TRACE_WARNING, "%s.%s threw exception %s",
func.__module__, func.__name__, str(exc))
raise
logger.log(TRACE_VERBOSE, "Exiting %s", func.__name__)
diff --git a/src/python/setup.py b/src/python/setup.py
index 8e72bfe..9d4ef7c 100644
--- a/src/python/setup.py
+++ b/src/python/setup.py
@@ -5,9 +5,9 @@ setup(
author='Michal Minar',
author_email='miminar@redhat.com',
url='https://fedorahosted.org/openlmi/',
- version='0.1',
+ version='0.2',
namespace_packages = ['openlmi'],
- packages = ['openlmi'],
+ packages = ['openlmi', 'openlmi.common'],
classifiers=[
'license :: osi approved :: gnu lesser general public license v2 or later (lgplv2+)',
'operating system :: posix :: linux',
diff --git a/src/software/openlmi/software/LMI_SoftwareFileCheck.py b/src/software/openlmi/software/LMI_SoftwareFileCheck.py
index 7d4aea6..58470bb 100644
--- a/src/software/openlmi/software/LMI_SoftwareFileCheck.py
+++ b/src/software/openlmi/software/LMI_SoftwareFileCheck.py
@@ -28,11 +28,11 @@ Instruments the CIM class LMI_SoftwareFileCheck
import pywbem
from pywbem.cim_provider2 import CIMProvider2
+from openlmi.common import cmpi_logging
from openlmi.software.core import SoftwareFileCheck
-from openlmi.software.util import cmpi_logging
from openlmi.software.yumdb import YumDB
-class LMI_SoftwareFileCheck(CIMProvider2): # pylint: disable=R0904
+class LMI_SoftwareFileCheck(CIMProvider2):
"""Instrument the CIM class LMI_SoftwareFileCheck
Identifies a file contained by RPM package. It's located in directory
diff --git a/src/software/openlmi/software/LMI_SoftwareInstalledPackage.py b/src/software/openlmi/software/LMI_SoftwareInstalledPackage.py
index d82a5a2..4206a46 100644
--- a/src/software/openlmi/software/LMI_SoftwareInstalledPackage.py
+++ b/src/software/openlmi/software/LMI_SoftwareInstalledPackage.py
@@ -29,13 +29,13 @@ Instruments the CIM class LMI_SoftwareInstalledPackage
import pywbem
from pywbem.cim_provider2 import CIMProvider2
+from openlmi.common import cmpi_logging
from openlmi.software.core import (
ComputerSystem, SoftwareFileCheck,
SoftwareInstalledPackage, SoftwarePackage)
-from openlmi.software.util import cmpi_logging
from openlmi.software.yumdb import YumDB
-class LMI_SoftwareInstalledPackage(CIMProvider2): #pylint: disable=R0904
+class LMI_SoftwareInstalledPackage(CIMProvider2):
"""Instrument the CIM class LMI_SoftwareInstalledPackage
The InstalledSoftwareElement association allows the identification of
diff --git a/src/software/openlmi/software/LMI_SoftwarePackage.py b/src/software/openlmi/software/LMI_SoftwarePackage.py
index e031998..17483e8 100644
--- a/src/software/openlmi/software/LMI_SoftwarePackage.py
+++ b/src/software/openlmi/software/LMI_SoftwarePackage.py
@@ -29,8 +29,8 @@ Instruments the CIM class LMI_SoftwarePackage
import pywbem
from pywbem.cim_provider2 import CIMProvider2
+from openlmi.common import cmpi_logging
from openlmi.software.core import SoftwarePackage
-from openlmi.software.util import cmpi_logging
from openlmi.software.yumdb import YumDB
class LMI_SoftwarePackage(CIMProvider2):
diff --git a/src/software/openlmi/software/LMI_SoftwarePackageChecks.py b/src/software/openlmi/software/LMI_SoftwarePackageChecks.py
index 76befe0..48faabc 100644
--- a/src/software/openlmi/software/LMI_SoftwarePackageChecks.py
+++ b/src/software/openlmi/software/LMI_SoftwarePackageChecks.py
@@ -28,11 +28,11 @@ Instruments the CIM class LMI_SoftwarePackageChecks
import pywbem
from pywbem.cim_provider2 import CIMProvider2
+from openlmi.common import cmpi_logging
from openlmi.software.core import (SoftwarePackage, SoftwareFileCheck)
-from openlmi.software.util import cmpi_logging
from openlmi.software.yumdb import YumDB
-class LMI_SoftwarePackageChecks(CIMProvider2): #pylint: disable=R0904
+class LMI_SoftwarePackageChecks(CIMProvider2):
"""Instrument the CIM class LMI_SoftwarePackageChecks
This association ties a SoftwareElement to a specific Check to validate
diff --git a/src/software/openlmi/software/cimom_entry.py b/src/software/openlmi/software/cimom_entry.py
index 59c01ee..9e6e10c 100644
--- a/src/software/openlmi/software/cimom_entry.py
+++ b/src/software/openlmi/software/cimom_entry.py
@@ -24,13 +24,13 @@
Entry module for OpenLMI Software proviers.
"""
+from openlmi.common import cmpi_logging
from openlmi.software.LMI_SoftwarePackage import LMI_SoftwarePackage
from openlmi.software.LMI_SoftwareInstalledPackage import \
LMI_SoftwareInstalledPackage
from openlmi.software.LMI_SoftwareFileCheck import LMI_SoftwareFileCheck
from openlmi.software.LMI_SoftwarePackageChecks import \
LMI_SoftwarePackageChecks
-from openlmi.software.util import cmpi_logging
from openlmi.software.yumdb import YumDB
def get_providers(env):
diff --git a/src/software/openlmi/software/core/SoftwareFileCheck.py b/src/software/openlmi/software/core/SoftwareFileCheck.py
index fe844c1..409db09 100644
--- a/src/software/openlmi/software/core/SoftwareFileCheck.py
+++ b/src/software/openlmi/software/core/SoftwareFileCheck.py
@@ -31,8 +31,8 @@ import pywbem
import stat
import yum
+from openlmi.common import cmpi_logging
from openlmi.software import util
-from openlmi.software.util import cmpi_logging
from openlmi.software.yumdb import YumDB
from openlmi.software.yumdb import packageinfo
from openlmi.software.yumdb import packagecheck
diff --git a/src/software/openlmi/software/core/SoftwarePackage.py b/src/software/openlmi/software/core/SoftwarePackage.py
index 3e7284f..0ef0d31 100644
--- a/src/software/openlmi/software/core/SoftwarePackage.py
+++ b/src/software/openlmi/software/core/SoftwarePackage.py
@@ -26,8 +26,8 @@ Just a common functionality related to LMI_SoftwarePackage provider.
import pywbem
+from openlmi.common import cmpi_logging
from openlmi.software import util
-from openlmi.software.util import cmpi_logging
from openlmi.software.yumdb import PackageInfo, YumDB
@cmpi_logging.trace_function
diff --git a/src/software/openlmi/software/yumdb/__init__.py b/src/software/openlmi/software/yumdb/__init__.py
index 54eeae0..0cccdea 100644
--- a/src/software/openlmi/software/yumdb/__init__.py
+++ b/src/software/openlmi/software/yumdb/__init__.py
@@ -41,13 +41,13 @@ import Queue as TQueue # T as threaded
import threading
import yum
+from openlmi.common import cmpi_logging
from openlmi.software.yumdb import jobs
from openlmi.software.yumdb import errors
from openlmi.software.yumdb.packageinfo import PackageInfo
from openlmi.software.yumdb.packagecheck import PackageFile
from openlmi.software.yumdb.packagecheck import PackageCheck
from openlmi.software.yumdb.process import YumWorker
-from openlmi.software.util import cmpi_logging
from openlmi.software.util import singletonmixin
# this may be used as an argument to YumWorker