os-apply-config fails with TypeError: string indices must be integers when traversing strings

Bug #1321827 reported by Coleman Corrigan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
os-apply-config
Fix Released
Medium
Coleman Corrigan

Bug Description

os-apply-config fails with a TypeError when searching for a non existent key if parent component of the key is a string
e.g:
/os_apply_config# os-apply-config --key db-password.s --type raw --key-default ''
Traceback (most recent call last):
  File "/usr/local/bin/os-apply-config", line 11, in <module>
    sys.exit(main())
  File "/opt/stack/venvs/os-apply-config/local/lib/python2.7/site-packages/os_apply_config/apply_config.py", line 281, in main
    opts.fallback_metadata)
  File "/opt/stack/venvs/os-apply-config/local/lib/python2.7/site-packages/os_apply_config/apply_config.py", line 84, in print_key
    config = config[key]
TypeError: string indices must be integers

but

# os-apply-config --key non.existent.key.tree.s --type raw --key-default ''

/os_apply_config#

inconsistent behaviour - IMHO both cases should return the key-default

Changed in os-apply-config:
importance: Undecided → Medium
status: New → Triaged
Changed in os-apply-config:
assignee: nobody → Coleman Corrigan (coleman-corrigan)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to os-apply-config (master)

Reviewed: https://review.openstack.org/94810
Committed: https://git.openstack.org/cgit/openstack/os-apply-config/commit/?id=e3aa1631c11cc6fd815cf26cb4e23ca4010309ff
Submitter: Jenkins
Branch: master

commit e3aa1631c11cc6fd815cf26cb4e23ca4010309ff
Author: Coleman Corrigan <email address hidden>
Date: Thu May 22 10:56:52 2014 +0100

    Fix for string key traversal bug #1321827

    Gracefully handle the traversal of strings in a key search path.

    Closes-Bug: #1321827

    Change-Id: I1fab13905fc1f6ed2817081d58fcc5379f2a8515

Changed in os-apply-config:
status: In Progress → Fix Committed
Changed in os-apply-config:
status: Fix Committed → Fix Released
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.