diff options
author | Dmitry Tantsur <dtantsur@protonmail.com> | 2020-04-02 11:05:11 +0200 |
---|---|---|
committer | Dmitry Tantsur <dtantsur@protonmail.com> | 2020-04-02 11:52:04 +0200 |
commit | 9f93694b9ae41811c43d66ce56d34422f9991f06 (patch) | |
tree | 66046bf14a91c2028dd532dc34099d43812e2253 | |
parent | cbeb1ff0b517ec48d3e60293b029ee3cd43b3a36 (diff) | |
download | ironic-9f93694b9ae41811c43d66ce56d34422f9991f06.tar.gz |
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
-rw-r--r-- | doc/source/admin/gmr.rst | 10 | ||||
-rw-r--r-- | ironic/cmd/api.py | 14 | ||||
-rw-r--r-- | ironic/cmd/conductor.py | 11 | ||||
-rw-r--r-- | releasenotes/notes/oslo-reports-optional-59469955eaffdf1d.yaml | 6 | ||||
-rw-r--r-- | requirements.txt | 1 | ||||
-rw-r--r-- | setup.cfg | 4 |
6 files changed, 41 insertions, 5 deletions
diff --git a/doc/source/admin/gmr.rst b/doc/source/admin/gmr.rst index 7b638492d..61da8f070 100644 --- a/doc/source/admin/gmr.rst +++ b/doc/source/admin/gmr.rst @@ -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 ---------------- diff --git a/ironic/cmd/api.py b/ironic/cmd/api.py index 74333e72e..1e8dbcdf6 100644 --- a/ironic/cmd/api.py +++ b/ironic/cmd/api.py @@ -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) diff --git a/ironic/cmd/conductor.py b/ironic/cmd/conductor.py index cce081839..d8fbcfec9 100644 --- a/ironic/cmd/conductor.py +++ b/ironic/cmd/conductor.py @@ -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', diff --git a/releasenotes/notes/oslo-reports-optional-59469955eaffdf1d.yaml b/releasenotes/notes/oslo-reports-optional-59469955eaffdf1d.yaml new file mode 100644 index 000000000..25e9f3f81 --- /dev/null +++ b/releasenotes/notes/oslo-reports-optional-59469955eaffdf1d.yaml @@ -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. diff --git a/requirements.txt b/requirements.txt index fff36d71b..4f4a1a1a9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 @@ -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 |