diff options
author | Michal Minar <miminar@redhat.com> | 2013-10-03 14:01:10 +0200 |
---|---|---|
committer | Michal Minar <miminar@redhat.com> | 2013-10-04 09:53:38 +0200 |
commit | 26c4d6f44baddde9c3451eeec448e9b4ac8084c4 (patch) | |
tree | fdb6e91ca714f477b00c182648a47d41cc73efa6 | |
parent | 05b40dcd5d0e3e52fd899a47f0656afb0f4913c3 (diff) | |
download | openlmi-providers-26c4d6f44baddde9c3451eeec448e9b4ac8084c4.tar.gz openlmi-providers-26c4d6f44baddde9c3451eeec448e9b4ac8084c4.tar.xz openlmi-providers-26c4d6f44baddde9c3451eeec448e9b4ac8084c4.zip |
software: fix startup
It may happen that get_providers are called twice in single python
process. Let's prevent an error to be raised due to double instantiation
of IndicationManager which is a singleton.
-rw-r--r-- | src/software/lmi/software/cimom_entry.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/software/lmi/software/cimom_entry.py b/src/software/lmi/software/cimom_entry.py index 33ac7bf..ffac501 100644 --- a/src/software/lmi/software/cimom_entry.py +++ b/src/software/lmi/software/cimom_entry.py @@ -24,8 +24,10 @@ Entry module for OpenLMI Software providers. """ +import logging from multiprocessing import Queue +from lmi.base import singletonmixin from lmi.providers import cmpi_logging from lmi.providers import JobManager from lmi.providers.IndicationManager import IndicationManager @@ -118,9 +120,13 @@ def get_providers(env): # Initialization of indication manager -- running in separate thread as # daemon. That means it does not have to be cleaned up. - im = IndicationManager.get_instance( - env, "Software", util.Configuration.get_instance().namespace, - queue=Queue()) + try: + im = IndicationManager.get_instance( + env, "Software", util.Configuration.get_instance().namespace, + queue=Queue()) + except singletonmixin.SingletonException: + logging.get_logger(__name__).warn( + 'IndicationManager instantiated for second time') JobManager.register_filters("LMI_SoftwareInstallationJob", im) JobManager.register_filters("LMI_SoftwareVerificationJob", im) |