Skip to content

Conversation

@DanSheps
Copy link
Member

Fixes: #14839

  • Check for tunnel termination type in the form data and instance in addition to intially passed data.

Comment on lines 269 to 275
if (
initial and initial.get('type') == TunnelTerminationTypeChoices.TYPE_VIRTUALMACHINE
) or (
self.data and self.data.get('type') == TunnelTerminationTypeChoices.TYPE_VIRTUALMACHINE
) or (
self.instance.pk and isinstance(self.instance.termination.parent_object, VirtualMachine)
):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run-on conditionals like this are not viable from a maintainability standpoint. Please have a look at how we've used the get_field_value() utility function in other forms to avoid this.

@jeremystretch jeremystretch merged commit 1a9149d into develop Feb 5, 2024
@jeremystretch jeremystretch deleted the 14839-fix-vm-vpn-tunnel-termination branch February 5, 2024 14:59
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to create tunnel termination for virtual machine

3 participants