summaryrefslogtreecommitdiffstats
path: root/src/software
diff options
context:
space:
mode:
authorMichal Minar <miminar@redhat.com>2013-05-10 15:15:23 +0200
committerMichal Minar <miminar@redhat.com>2013-07-03 12:45:59 +0200
commit2cf31bd8735ac61d762cc77f3234e566b465a928 (patch)
tree632885d59911c1ee0d59869c4d29681aefafd14e /src/software
parenta380de9372056e2530dd7a5a67c54f08ae150a34 (diff)
downloadopenlmi-providers-2cf31bd8735ac61d762cc77f3234e566b465a928.tar.gz
openlmi-providers-2cf31bd8735ac61d762cc77f3234e566b465a928.tar.xz
openlmi-providers-2cf31bd8735ac61d762cc77f3234e566b465a928.zip
delete YumDB singleton in YumWorker process
YumDB singleton launches YumWorker process and then serves as its interface. We don't need its instance in separate process. Deleting it allows us to check, whether we run under broker process or under YumWorker. clean up YumDB instance only if it's instantiated
Diffstat (limited to 'src/software')
-rw-r--r--src/software/openlmi/software/cimom_entry.py3
-rw-r--r--src/software/openlmi/software/yumdb/process.py8
2 files changed, 10 insertions, 1 deletions
diff --git a/src/software/openlmi/software/cimom_entry.py b/src/software/openlmi/software/cimom_entry.py
index f34188c..4dd0d40 100644
--- a/src/software/openlmi/software/cimom_entry.py
+++ b/src/software/openlmi/software/cimom_entry.py
@@ -210,4 +210,5 @@ def shutdown(_env):
"""
Release resources upon cleanup.
"""
- YumDB.get_instance().clean_up()
+ if YumDB.isInstantiated():
+ YumDB.get_instance().clean_up()
diff --git a/src/software/openlmi/software/yumdb/process.py b/src/software/openlmi/software/yumdb/process.py
index 2eb207f..c4171ec 100644
--- a/src/software/openlmi/software/yumdb/process.py
+++ b/src/software/openlmi/software/yumdb/process.py
@@ -898,6 +898,14 @@ class YumWorker(Process):
self._jobmgr.name, self._jobmgr.ident)
self._pkg_cache = weakref.WeakValueDictionary()
+ # We've been started by YumDB, but in this process we don't need
+ # the instance object - let's delete it.
+ # This allows the code, that can be run both from broker and YumWorker
+ # process, to check it. When run under broker, the
+ # YumDB.isInstantiated() returns True.
+ from openlmi.software.yumdb import YumDB
+ YumDB._forget_class_instance_reference_for_testing()
+
self._main_loop()
LOG.info("terminating")