Skip to content

Commit

Permalink
Merge "Fix delete_network_postcommit KeyError"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Oct 20, 2023
2 parents 9c5d087 + c3b3b61 commit 202177f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 6 additions & 6 deletions networking_generic_switch/generic_switch_mech.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def create_network_postcommit(self, context):

network = context.current
network_id = network['id']
provider_type = network['provider:network_type']
segmentation_id = network['provider:segmentation_id']
physnet = network['provider:physical_network']
provider_type = network.get('provider:network_type')
segmentation_id = network.get('provider:segmentation_id')
physnet = network.get('provider:physical_network')

if provider_type == 'vlan' and segmentation_id:
# Create vlan on all switches from this driver
Expand Down Expand Up @@ -165,9 +165,9 @@ def delete_network_postcommit(self, context):
deleted.
"""
network = context.current
provider_type = network['provider:network_type']
segmentation_id = network['provider:segmentation_id']
physnet = network['provider:physical_network']
provider_type = network.get('provider:network_type')
segmentation_id = network.get('provider:segmentation_id')
physnet = network.get('provider:physical_network')

if provider_type == 'vlan' and segmentation_id:
# Delete vlan on all switches from this driver
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fixes:
- |
Instead of always assuming we have all provider network metadata, instead
use a getter to avoid erroring in cases where that metadata may not be needed.

0 comments on commit 202177f

Please sign in to comment.