config generation(yaml/json) broken with python3

Bug #1768498 reported by yatin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Invalid
Undecided
Unassigned
oslo.config
Fix Released
Undecided
Lance Bragstad

Bug Description

config generation with format yaml/json is broken with python3

Reproduction steps:-
git clone https://github.com/openstack/keystone
cd keystone
sed -i '/\[testenv\:genconfig\]/a basepython=python3' tox.ini
tox -egenconfig
.tox/genconfig/bin/oslo-config-generator --config-file=config-generator/keystone.conf --format yaml --output-file=keystone-schema.yaml

The above command works fine when basepython=python2

with "ini" it works fine:-
.tox/genconfig/bin/oslo-config-generator --config-file=config-generator/keystone.conf --format ini --output-file=keystone-schema.yaml

Actual Output:-
Traceback (most recent call last):
  File ".tox/genconfig/bin/oslo-config-generator", line 11, in <module>
    sys.exit(main())
  File "/home/ykarel/work/keystone/.tox/genconfig/lib/python3.6/site-packages/oslo_config/generator.py", line 770, in main
    generate(conf)
  File "/home/ykarel/work/keystone/.tox/genconfig/lib/python3.6/site-packages/oslo_config/generator.py", line 754, in generate
    conf=conf)
  File "/home/ykarel/work/keystone/.tox/genconfig/lib/python3.6/site-packages/oslo_config/generator.py", line 690, in _output_machine_readable
    output_data = _generate_machine_readable_data(groups, conf)
  File "/home/ykarel/work/keystone/.tox/genconfig/lib/python3.6/site-packages/oslo_config/generator.py", line 655, in _generate_machine_readable_data
    entry = _build_entry(opt, group_name, namespace[0], conf)
  File "/home/ykarel/work/keystone/.tox/genconfig/lib/python3.6/site-packages/oslo_config/generator.py", line 601, in _build_entry
    entry['type'] = _format_type_name(entry['type'])
  File "/home/ykarel/work/keystone/.tox/genconfig/lib/python3.6/site-packages/oslo_config/generator.py", line 157, in _format_type_name
    return _TYPE_NAMES[opt_type]
TypeError: unhashable type: 'HostAddress'

Expected Output:-
keystone-schema.yaml should be generated

This should be a bug for oslo.config, but found in keystone so reporting against it as well.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.config (master)

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

Changed in oslo.config:
assignee: nobody → Lance Bragstad (lbragstad)
status: New → In Progress
Revision history for this message
Lance Bragstad (lbragstad) wrote :

Thanks for the bug report. I was able to recreate this. Fortunately, we can keep the fix isolated to oslo.config with the patch in comment #1.

Marking this as invalid for keystone since there shouldn't be anything specific to keystone to trigger this. This will affect any project registering a HostAddressOpt using oslo.config and trying to generate samples using python3.

Changed in keystone:
status: New → Invalid
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.config (master)

Reviewed: https://review.openstack.org/566748
Committed: https://git.openstack.org/cgit/openstack/oslo.config/commit/?id=3e7eecc9f43e4b326018c09d6976489ba5b0d098
Submitter: Zuul
Branch: master

commit 3e7eecc9f43e4b326018c09d6976489ba5b0d098
Author: Lance Bragstad <email address hidden>
Date: Mon May 7 21:45:22 2018 +0000

    Properly initialize HostAddress

    The HostAddress class wasn't calling super in it's __init__() method,
    which resulted in the type_name not being set properly for instances
    of that class.

    Change-Id: I4e589f2081e5d95227938cba9ad1158548bc1048
    Closes-Bug: 1768498

Changed in oslo.config:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/oslo.config 6.2.1

This issue was fixed in the openstack/oslo.config 6.2.1 release.

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.