config generator fails when project enables lazy messages

Bug #1280826 reported by James Carey
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
Undecided
Luis A. Garcia
Cinder
Fix Released
High
Jay Bryant
OpenStack Compute (nova)
Fix Released
Undecided
James Carey
oslo-incubator
Fix Released
High
James Carey

Bug Description

When lazy message translation is enabled in Nova, the check_update.sh calls generate_sample.sh, which uses a copy of oslo's config/generator.py which produces the following message:

CRITICAL nova [-] TypeError: Message objects do not support addition.

The config/generator.py module installs i18n without lazy enabled (named parameter 'lazy' not specified):

gettextutils.install('nova')

To gather information about the projects options, it loads the project modules looking for entry points. When these modules are loaded, they may contain code to enable lazy. In the case of Nova this is the nova/cmds/__init__.py which calls:

gettextutils.enable_lazy()

This means that the messages returned with information for the entry points are lazy enabled. Thus when config/generator.py tries to work with the help message for the option associated with the Nova modules:

opt_help += ' (' + OPT_TYPES[opt_type] + ')'

it fails because opt_help is a gettextutils.Message instance, which doesn't support addition.

Tags: oslo
James Carey (jecarey)
Changed in oslo:
assignee: nobody → James Carey (jecarey)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

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

Changed in oslo:
status: New → In Progress
James Carey (jecarey)
Changed in nova:
assignee: nobody → James Carey (jecarey)
Revision history for this message
Jay Bryant (jsbryant) wrote :

This change is required to get lazy translation working for Cinder. This patch will be dependent upon this change: https://review.openstack.org/#/c/70465/

Changed in cinder:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Jay Bryant (jsbryant)
Changed in oslo:
importance: Undecided → High
milestone: none → icehouse-3
Matt Riedemann (mriedem)
tags: added: oslo
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo-incubator (master)

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

commit e839886cc19982d351f0ef0888188b92f187e2fc
Author: James Carey <email address hidden>
Date: Sun Feb 16 16:23:48 2014 +0000

    Config generator fails with lazy messages

    Entry points from modules loaded from projects may have help text
    that is i18n lazy enabled, which causes a failure because
    gettextutils.Message (a subclass of six.text_type) explicitly
    does not support concatenation. Change from using concatenation
    to using format (%) to allow six.text_type to do the right thing.

    Change-Id: Ie60c569ae6fe227e16eef4a3281cf042732addc3
    Closes-Bug: #1280826

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

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

Changed in nova:
status: New → In Progress
Jay Bryant (jsbryant)
Changed in cinder:
milestone: none → icehouse-3
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/75740

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

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

Changed in ceilometer:
assignee: nobody → Luis A. Garcia (luisg-8)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

Reviewed: https://review.openstack.org/76069
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=c38d242a0f901a6d99c5f35475edc329b038e36f
Submitter: Jenkins
Branch: master

commit c38d242a0f901a6d99c5f35475edc329b038e36f
Author: Luis A. Garcia <email address hidden>
Date: Tue Feb 25 01:53:42 2014 +0000

    Sync latest config file generator from oslo-incubator

    The fix to the config file generator to support lazy messages
    is the main addition of interest because it is needed after
    lazy messages were enabled.

    Commits included:
      1a6dfb956 Sanitize FQDN in config generator
      e839886cc Config generator fails with lazy messages
      763eedff6 Fix DictOpt support in config sample generator

    Partially implements blueprint i18n-messages
    Closes-Bug: #1280826

    Change-Id: I2174139ba3767d05924747cbefa377ba8780103d

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

Reviewed: https://review.openstack.org/75644
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=88b7380d0e7c398780d2bb20abd1936e7c879665
Submitter: Jenkins
Branch: master

commit 88b7380d0e7c398780d2bb20abd1936e7c879665
Author: James Carey <email address hidden>
Date: Sat Feb 22 18:59:41 2014 +0000

    Sync latest config file generator from oslo-incubator

    The fix to the config file generator to support lazy messages
    is the main addition of interest because it is needed before
    lazy messages can be enabled in Nova.

    Commits included:

      1a6dfb956 Sanitize FQDN in config generator
      e839886cc Config generator fails with lazy messages
      763eedff6 Fix DictOpt support in config sample generator

    Note that these commits do not touch any other files (beyond
    oslo testcases).

    Partially implements blueprint i18n-messages
    Closes-Bug: #1280826

    Change-Id: I2174139ba3767d05924747cbefa377ba8780103d

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
Allison Randal (allison) wrote :

The change was reverted in nova: https://review.openstack.org/77852

Changed in nova:
status: Fix Committed → In Progress
Revision history for this message
Ben Nemec (bnemec) wrote :

The revert was abandoned because the problem it was trying to fix wasn't due to this change.

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
Allison Randal (allison) wrote :

And revert abandoned in favor of: https://review.openstack.org/77874

Thierry Carrez (ttx)
Changed in nova:
milestone: none → icehouse-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: icehouse-3 → icehouse-rc1
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: none → icehouse-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in oslo:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/75740
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=9550b6b6b486559b7c89b94e7ffb20b794aaa795
Submitter: Jenkins
Branch: master

commit 9550b6b6b486559b7c89b94e7ffb20b794aaa795
Author: Jay S. Bryant <email address hidden>
Date: Sun Feb 23 19:51:41 2014 -0600

    Sync latest Oslo config code for i18n

    This sync pulls the latest Oslo config code over
    to Cinder. This sync is needed to include a fix
    to config generator which is needed as part of
    the work to enabled i18n messages. Config generator
    was failing when lazy message translation was enabled.

    The following changes are included with this patch. Each
    patch includes the file(s) the patch touches:
    -> c178e56 Add basic Python 3 tests
    --> cinder/openstack/common/__init__.py
    -> 12bcdb7 Remove vim header
    --> cinder/openstack/common/__init__.py
    -> 547ab34 Fix Copyright Headers - Rename LLC to Foundation
    --> cinder/openstack/common/__init__.py
    -> 44b6ea3 Import oslo.config configuration file generator
    --> cinder/openstack/common/config/__init__.py
    -> dd9aa2b Remove unused variables
    --> cinder/openstack/common/config/generator.py
    -> 5dce17b Use entry points to discover options in libraries
    --> tools/config/generate_sample.sh
    --> cinder/openstack/common/config/generator.py
    -> e8e636c generator: add an EXTRA_LIBRARIES env variable
    --> cinder/openstack/common/config/generator.py
    -> e3dddd7 generator: use EXTRA_* env vars in the bash script
    --> tools/config/generate_sample.sh
    --> cinder/openstack/common/config/generator.py
    -> 6da13e8 generator: rename EXTRA_MODULES_FILE to RC_FILE
    --> tools/config/generate_sample.sh
    -> 763eedf Fix DictOpt support in config sample generator
    --> cinder/openstack/common/config/generator.py
    -> e839886 Config generator fails with lazy messages
    --> cinder/openstack/common/config/generator.py
    -> 343686b Add check_uptodate to tools/config
    --> tools/config/check_uptodate.sh

    Oslo version:
    -> 0f24d82 Fix migration.db_version when no tables
    -> Date: Sat, 22 Feb 2014 00:32:18 +0000

    Change-Id: I26a95fe96b08d6340b0fce1b9e2949c8e661a946
    Closes-Bug: 1280826
    Related-bp: i18n-messages

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in oslo:
milestone: icehouse-3 → 2014.1
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: icehouse-3 → 2014.1
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-3 → 2014.1
Thierry Carrez (ttx)
Changed in cinder:
milestone: icehouse-rc1 → 2014.1
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.