Make oslo.reports an optional dependency

It is only required for one specific feature, let people install it
if they need it.

This change is a part of the major effort to reduce the number of
ironic dependencies.

Change-Id: Ia45ce1d573c89f583d641be3d37d1c127e6345bc
This commit is contained in:
Dmitry Tantsur 2020-04-02 11:05:11 +02:00
parent cbeb1ff0b5
commit 9f93694b9a
6 changed files with 41 additions and 5 deletions

View File

@ -12,6 +12,16 @@ and more. The eventlet backdoor facility provides an interactive shell
interface for any eventlet based process, allowing an administrator to
telnet to a pre-defined port and execute a variety of commands.
Configuration
-------------
The GMR feature is optional and requires the oslo.reports_ package to be
installed. For example, using pip::
pip install 'oslo.reports>=1.18.0'
.. _oslo.reports: https://opendev.org/openstack/oslo.reports
Generating a GMR
----------------

View File

@ -20,7 +20,11 @@
import sys
from oslo_config import cfg
from oslo_reports import guru_meditation_report as gmr
from oslo_log import log
try:
from oslo_reports import guru_meditation_report as gmr
except ImportError:
gmr = None
from ironic.common import profiler
from ironic.common import service as ironic_service
@ -29,12 +33,18 @@ from ironic import version
CONF = cfg.CONF
LOG = log.getLogger(__name__)
def main():
# Parse config file and command line options, then start logging
ironic_service.prepare_service(sys.argv)
gmr.TextGuruMeditation.setup_autorun(version)
if gmr is not None:
gmr.TextGuruMeditation.setup_autorun(version)
else:
LOG.debug('Guru meditation reporting is disabled '
'because oslo.reports is not installed')
profiler.setup('ironic_api', CONF.host)

View File

@ -23,7 +23,10 @@ import sys
from oslo_config import cfg
from oslo_log import log
from oslo_reports import guru_meditation_report as gmr
try:
from oslo_reports import guru_meditation_report as gmr
except ImportError:
gmr = None
from oslo_service import service
from ironic.common import profiler
@ -83,7 +86,11 @@ def main():
# Parse config file and command line options, then start logging
ironic_service.prepare_service(sys.argv)
gmr.TextGuruMeditation.setup_autorun(version)
if gmr is not None:
gmr.TextGuruMeditation.setup_autorun(version)
else:
LOG.debug('Guru meditation reporting is disabled '
'because oslo.reports is not installed')
mgr = rpc_service.RPCService(CONF.host,
'ironic.conductor.manager',

View File

@ -0,0 +1,6 @@
---
upgrade:
- |
The guru meditation reporting functionality is now optional and the
``oslo.reports`` package is no longer a part of requirements. Install it
manually if you need this feature.

View File

@ -25,7 +25,6 @@ oslo.i18n>=3.15.3 # Apache-2.0
oslo.log>=3.36.0 # Apache-2.0
oslo.middleware>=3.31.0 # Apache-2.0
oslo.policy>=1.30.0 # Apache-2.0
oslo.reports>=1.18.0 # Apache-2.0
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
oslo.service!=1.28.1,>=1.24.0 # Apache-2.0
oslo.upgradecheck>=0.1.0 # Apache-2.0

View File

@ -196,3 +196,7 @@ output_file = ironic/locale/ironic.pot
[wheel]
universal = 1
[extras]
guru_meditation_reports =
oslo.reports>=1.18.0 # Apache-2.0