Needs to handle empty data other than {}

Bug #1426116 reported by Steve Baker
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
os-apply-config
Fix Released
Medium
Steve Baker

Bug Description

There have been 2 recent heat regressions (one which is still ongoing) which result in an empty string '' being set as the structured config instead of an empty dict {}

os-apply-config should be better at handling this case, instead it raises this error:
http://logs.openstack.org/90/159490/1/check-tripleo/check-tripleo-ironic-overcloud-f20-nonha/963c652/logs/ov-osp2xvg5ed4-0-5k2zhft6s4ag-Controller_logs/os-collect-config.txt.gz#_Feb_26_15_51_33

Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: [2015-02-26 15:51:33,096] (os-refresh-config) [INFO] Starting phase pre-configure
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: dib-run-parts Thu Feb 26 15:51:33 UTC 2015 Running /usr/libexec/os-refresh-config/pre-configure.d/00-fix-ephemeral-mount
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: ++ os-apply-config --key block-device-mapping.ephemeral0 --type raw --key-default ''
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: Traceback (most recent call last):
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: File "/usr/local/bin/os-apply-config", line 11, in <module>
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: sys.exit(main())
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: File "/opt/stack/venvs/openstack/lib/python2.7/site-packages/os_apply_config/apply_config.py", line 327, in main
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: opts.fallback_metadata)
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: File "/opt/stack/venvs/openstack/lib/python2.7/site-packages/os_apply_config/apply_config.py", line 84, in print_key
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: config = collect_config.collect_config(config_path, fallback_metadata)
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: File "/opt/stack/venvs/openstack/lib/python2.7/site-packages/os_apply_config/collect_config.py", line 69, in collect_config
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: return merge_configs(parse_configs(read_configs(os_config_files)))
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: File "/opt/stack/venvs/openstack/lib/python2.7/site-packages/os_apply_config/collect_config.py", line 61, in merge_configs
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: final_conf = _deep_merge_dict(final_conf, conf)
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: File "/opt/stack/venvs/openstack/lib/python2.7/site-packages/os_apply_config/collect_config.py", line 53, in _deep_merge_dict
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: new_dict[k] = copy.deepcopy(v)
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: TypeError: 'unicode' object does not support item assignment
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: + ephemeraldisk=
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: [2015-02-26 15:51:33,403] (os-refresh-config) [ERROR] during pre-configure phase. [Command '['dib-run-parts', '/usr/libexec/os-refresh-config/pre-configure.d']' returned non-zero exit status 1]
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: [2015-02-26 15:51:33,404] (os-refresh-config) [ERROR] Aborting...
Feb 26 15:51:33 ov-osp2xvg5ed4-0-5k2zhft6s4ag-controller-jm2wffxacbq2 os-collect-config[791]: 2015-02-26 15:51:33.408 791 ERROR os-collect-config [-] Command failed, will not cache new data. Command 'os-refresh-config' returned non-zero exit status 1

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

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

Changed in os-apply-config:
assignee: nobody → Steve Baker (steve-stevebaker)
status: New → In Progress
Ben Nemec (bnemec)
Changed in os-apply-config:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to os-apply-config (master)

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

commit 94f9819c67a4d8f37efcfdd2eee4eb6369a06bb7
Author: Steve Baker <email address hidden>
Date: Fri Feb 27 09:38:21 2015 +1300

    Ignore top-level merge items which evaluate False

    There has been recent tripleo regressions caused by heat
    setting empty config as '' rather than {} which cause os-apply-config
    to error on merge_configs.

    This change ignores any top-level config which evaluates to False,
    ignoring possible empty data including '', {}, None, []

    An os-apply-config release with this fix would likely allow the current
    heat pin to be removed Id134664a5df7232da0fb5d9ed62b82e12b3d54a8

    Change-Id: Ia5bd99d1550f43760c064b769be3be46b3417331
    Closes-Bug: #1426116
    Related-Bug: #1425238

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.