
from oslo_reports import guru_meditation_report as gmr

from neutron import version

_version_string = version.version_info.release_string()
gmr.TextGuruMeditation.setup_autorun(version=_version_string)


import logging as sys_logging

from oslo_reports import guru_meditation_report as gmr

from neutron import version

# During the call to gmr.TextGuruMeditation.setup_autorun(), Guru Meditation
# Report tries to start logging. Set a handler here to accommodate this.
logger = sys_logging.getLogger(None)
if not logger.handlers:
    logger.addHandler(sys_logging.StreamHandler())

_version_string = version.version_info.release_string()
gmr.TextGuruMeditation.setup_autorun(version=_version_string)

Fix logging error for Guru Meditation Report
Fix logging error for Guru Meditation Report

Currently, invoking any of the commands under neutron/cmd will trigger a
"No handlers could be found" error for Guru Meditation Report. This is
interupting the notify.sh script that is called by dibbler-client during the
IPv6 Prefix Delegation workflow.

This patch adds a logging handler to __init__.py to prevent the error.

Without the error message being thrown, neutron-pd-notify is once again
able to complete successfully when called by dibbler-client.

Change-Id: Iac3162f6b7e968c2f11fd8ef2a6e275242fb21ff
Closes-Bug: 1532053

+ 
+ import logging as sys_logging
  
  from oslo_reports import guru_meditation_report as gmr
  
  from neutron import version
  
+ # During the call to gmr.TextGuruMeditation.setup_autorun(), Guru Meditation
+ # Report tries to start logging. Set a handler here to accommodate this.
+ logger = sys_logging.getLogger(None)
+ if not logger.handlers:
+     logger.addHandler(sys_logging.StreamHandler())
+ 
  _version_string = version.version_info.release_string()
  gmr.TextGuruMeditation.setup_autorun(version=_version_string)
  
Fix logging error for Guru Meditation Report
## Code Before:

from oslo_reports import guru_meditation_report as gmr

from neutron import version

_version_string = version.version_info.release_string()
gmr.TextGuruMeditation.setup_autorun(version=_version_string)

## Instruction:
Fix logging error for Guru Meditation Report
## Code After:

import logging as sys_logging

from oslo_reports import guru_meditation_report as gmr

from neutron import version

# During the call to gmr.TextGuruMeditation.setup_autorun(), Guru Meditation
# Report tries to start logging. Set a handler here to accommodate this.
logger = sys_logging.getLogger(None)
if not logger.handlers:
    logger.addHandler(sys_logging.StreamHandler())

_version_string = version.version_info.release_string()
gmr.TextGuruMeditation.setup_autorun(version=_version_string)
