AttributeError: ContextAdapter instance has no attribute 'isEnabledFor' with python 2.6

Bug #1343544 reported by Matt Riedemann
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Matt Riedemann
oslo-incubator
Fix Released
Undecided
Joshua Harlow

Bug Description

Running tempest against juno code on RHEL 6.5 (python 2.6), I'm seeing this in the cinder-volume logs:

I'm seeing several warnings from the taskflow code in the cinder volume log:

2014-07-17 02:36:27.703 57746 WARNING taskflow.utils.misc [req-b459108b-be18-4922-94b9-1f0281764bfb 4deacb6f0bb7409cb1bfab8d7080e61f 574d6c38c2fd4ce697071225ecdf2125 - - -] Failure calling callback <bound method DynamicLogListener._task_receiver of <cinder.flow_utils.DynamicLogListener object at 0x9997d4e0>> to notify about event SUCCESS, details: {'task_uuid': '6ef1507b-7749-40ab-8d5e-55bbf9347229', 'result': None, 'task_name': 'cinder.volume.flows.manager.create_volume.CreateVolumeOnFinishTask;volume:create, create.end'}
2014-07-17 02:36:27.703 57746 TRACE taskflow.utils.misc Traceback (most recent call last):
2014-07-17 02:36:27.703 57746 TRACE taskflow.utils.misc File "/usr/lib/python2.6/site-packages/taskflow/utils/misc.py", line 596, in notify
2014-07-17 02:36:27.703 57746 TRACE taskflow.utils.misc callback(event_type, *args, **kwargs)
2014-07-17 02:36:27.703 57746 TRACE taskflow.utils.misc File "/usr/lib/python2.6/site-packages/cinder/flow_utils.py", line 104, in _task_receiver
2014-07-17 02:36:27.703 57746 TRACE taskflow.utils.misc if (self._logger.isEnabledFor(base_logging.DEBUG) or
2014-07-17 02:36:27.703 57746 TRACE taskflow.utils.misc AttributeError: ContextAdapter instance has no attribute 'isEnabledFor'
2014-07-17 02:36:27.703 57746 TRACE taskflow.utils.misc

This is basically the same issue as keystone bug 1213284.

It looks like a limitation with logging in python 2.6.

We could just add isEnabledFor to the oslo log ContextAdapter in py26 for now to delegate to logger.isEnabledFor or punt (return False) until this is all moving to the server projects with oslo.log:

https://blueprints.launchpad.net/oslo/+spec/remove-context-adapter

Revision history for this message
Matt Riedemann (mriedem) wrote :
summary: AttributeError: ContextAdapter instance has no attribute 'isEnabledFor'
+ with python 2.6
Changed in oslo:
assignee: nobody → Joshua Harlow (harlowja)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo-incubator (master)

Reviewed: https://review.openstack.org/107812
Committed: https://git.openstack.org/cgit/openstack/oslo-incubator/commit/?id=726d00aa80a402afc83f8d22b74008cd4d306445
Submitter: Jenkins
Branch: master

commit 726d00aa80a402afc83f8d22b74008cd4d306445
Author: Joshua Harlow <email address hidden>
Date: Thu Jul 17 12:50:10 2014 -0700

    Adjust oslo logging to provide adapter is enabled for

    In python 2.6 the isEnabledFor adapter method is not found
    since it was added in 2.7+ so to enable its usage in openstack
    which can want to use this method add it on when in python 2.6
    and just call the parent method on other versions.

    Closes-Bug: #1343544

    Change-Id: I5c3ba91cb1a8555d649fffc1377e9e9dfe92fea8

Changed in oslo:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/110008

Changed in cinder:
assignee: nobody → Matt Riedemann (mriedem)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/110008
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=4499b62738e5ad25838eae0398f0d15bf5132387
Submitter: Jenkins
Branch: master

commit 4499b62738e5ad25838eae0398f0d15bf5132387
Author: Matt Riedemann <email address hidden>
Date: Mon Jul 28 06:19:23 2014 -0700

    Sync log from oslo-incubator for isEnabledFor fix

    Sync log.py to get commit:

    726d00a Adjust oslo logging to provide adapter is enabled for

    Which is needed to fix an issue with logging in flow_utils
    when using python 2.6.

    This also brings in dependencies.

    Changes:

    jsonutils
    ---------
    ef37e03 Added missing jsonutils.dump() function

    log
    ---
    726d00a Adjust oslo logging to provide adapter is enabled for
    433fa0b Make logging_context_format_string optional in log.set_defaults
    ac92c06 Add default log level for websocket
    5fd77eb Ability to customize default_log_levels for each project
    4d9328c Python 3: enable tests/unit/test_log.py
    cb5a804 Move `mask_password` to strutils
    3310d8d update new requests logger to default WARN

    strutils
    --------
    cb5a804 Move `mask_password` to strutils

    Change-Id: Iea344e4bd3a612cd4110143e4fbb8e2fdfd88165
    Closes-Bug: #1343544

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
milestone: none → juno-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in oslo-incubator:
milestone: none → juno-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: juno-3 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.