← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1832490] Re: Avoid keyerror which might cause failure of functional tests

 

Reviewed:  https://review.opendev.org/664865
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=a26e7a3bc08368f65169e27a20a0e1d286d26351
Submitter: Zuul
Branch:    master

commit a26e7a3bc08368f65169e27a20a0e1d286d26351
Author: Abhishek Kekane <akekane@xxxxxxxxxx>
Date:   Wed Jun 12 11:37:24 2019 +0000

    MultiStore: Avoid potential KeyError in functional tests
    
    For glance multiple store, image shows backend/store information
    in location metadata. It is accessed as a dictionary attribute, which can
    lead to KeyError if 'backend' key is not present in location metadata.
    
    To avoid this used get() call of dictionary which returns None if key
    is not present in the dictionary.
    
    Change-Id: I0f7fe80f13e79137c7bdaf5ec93e775c88b70cce
    Closes-Bug: #1832490


** Changed in: glance
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1832490

Title:
  Avoid keyerror which might cause failure of functional tests

Status in Glance:
  Fix Released

Bug description:
  During rocky glance has added ability to mention 'backend' information
  in the location as a metadata attribute. As of now while setting a
  class for multi_store [1] we are accessing 'backend' from location as
  it will always be present. This can lead us to KeyError if backend is
  not present/provided to image.

  To avoid this use dict.get() function which will return None if
  'backend' key is not present in the location metadata.

  Reference:
  Glance Store tips job [2] is failing with this issue at the moment.

  [1] https://github.com/openstack/glance/blob/master/glance/location.py#L70
  [2] http://logs.openstack.org/periodic/opendev.org/openstack/glance/master/glance-tox-functional-glance_store-tips/27b550c/testr_results.html.gz

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1832490/+subscriptions


References