Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypeError on missing network in update_port_postcommit() #126

Merged

Conversation

sebageek
Copy link
Collaborator

When a port is updated we try to clean up after it. As there is no explicit delete message, but only a update_port_postcommit() call, we handle deletion of the old host. For this, the delete call also needs the network, but in certain scenarios, there is no original network - most likely in cases where the port only gets its binding host updated, but stays in the same network. Therefore in these cases we now use the network_id given in the original bindings level. As segments are not always fully specified (or better: this is what I have seen in some places in the code, but am unsure if the segments are always fully specified or not within a NetworkContext (fully specified in this case means "missing the network_id entry")), I chose the "safe way", using the original network first, then look at the segment dict and if that fails we log a warning and return, i.e. don't try to clean up after the segment.

This fixes a TypeError, where when there was no original network, we'd try to lookup ['id'] to the original network, which was None.

When a port is updated we try to clean up after it. As there is no
explicit delete message, but only a update_port_postcommit() call,
we handle deletion of the old host. For this, the delete call also needs
the network, but in certain scenarios, there is no original network -
most likely in cases where the port only gets its binding host updated,
but stays in the same network. Therefore in these cases we now use the
network_id given in the original bindings level. As segments are not
always fully specified (or better: this is what I have seen in some
places in the code, but am unsure if the segments are always fully
specified or not within a NetworkContext (fully specified in this case
means "missing the network_id entry")), I chose the "safe way", using
the original network first, then look at the segment dict and if that
fails we log a warning and return, i.e. don't try to clean up after the
segment.

This fixes a TypeError, where when there was no original network, we'd
try to lookup ['id'] to the original network, which was None.
@sebageek sebageek merged commit 9d0da02 into stable/yoga-m3 Sep 27, 2023
3 checks passed
@sebageek sebageek deleted the fix-update-port-postcommit-with-no-orig-network branch September 27, 2023 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants