Reviewed: https://review.opendev.org/c/openstack/horizon/+/919430 Committed: https://opendev.org/openstack/horizon/commit/fcce68a914f49938137785a4635d781b5a1741df Submitter: "Zuul (22348)" Branch: master
commit fcce68a914f49938137785a4635d781b5a1741df Author: MinhNLH2 <[email protected]> Date: Sun May 19 20:58:47 2024 +0700 Prevent KeyError when getting value of optional key Closes-Bug: #2066115 Change-Id: Ica10eb749b48410583cb34bfa2fda0433a26c664 Signed-off-by: MinhNLH2 <[email protected]> ** Changed in: horizon Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Dashboard (Horizon). https://bugs.launchpad.net/bugs/2066115 Title: Prevent KeyError getting value of optional data Status in OpenStack Dashboard (Horizon): Fix Released Bug description: Problem: Some of optional data is retrieved in this way: backup_name = data['backup_name'] or None volume_id = data['volume_id'] or None etc... When the key does not exist, KeyError will be raised. Moreover, or None here is meaningless. Solution: Change to backup_name = data.get('backup_name') volume_id = data.get('volume_id') To manage notifications about this bug go to: https://bugs.launchpad.net/horizon/+bug/2066115/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

