From 8cfb5ac5c627504cf4199d77633cea66cb17457e Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 18 Feb 2020 16:56:50 -0500 Subject: [PATCH] Fixes #3967: Fix missing migration for interface templates of type "other" --- docs/release-notes/version-2.7.md | 1 + .../0097_interfacetemplate_type_other.py | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 netbox/dcim/migrations/0097_interfacetemplate_type_other.py diff --git a/docs/release-notes/version-2.7.md b/docs/release-notes/version-2.7.md index 458328369..02b3aa9bf 100644 --- a/docs/release-notes/version-2.7.md +++ b/docs/release-notes/version-2.7.md @@ -8,6 +8,7 @@ ## Bug Fixes * [#2519](https://github.com/netbox-community/netbox/issues/2519) - Avoid race condition when provisioning "next available" IPs/prefixes via the API +* [#3967](https://github.com/netbox-community/netbox/issues/3967) - Fix missing migration for interface templates of type "other" * [#4168](https://github.com/netbox-community/netbox/issues/4168) - Role is not required when creating a virtual machine * [#4175](https://github.com/netbox-community/netbox/issues/4175) - Fix potential exception when bulk editing objects from a filtered list * [#4179](https://github.com/netbox-community/netbox/issues/4179) - Site is required when creating a rack group or power panel diff --git a/netbox/dcim/migrations/0097_interfacetemplate_type_other.py b/netbox/dcim/migrations/0097_interfacetemplate_type_other.py new file mode 100644 index 000000000..d71b5c655 --- /dev/null +++ b/netbox/dcim/migrations/0097_interfacetemplate_type_other.py @@ -0,0 +1,20 @@ +from django.db import migrations + + +def interfacetemplate_type_to_slug(apps, schema_editor): + InterfaceTemplate = apps.get_model('dcim', 'InterfaceTemplate') + InterfaceTemplate.objects.filter(type=32767).update(type='other') + + +class Migration(migrations.Migration): + + dependencies = [ + ('dcim', '0096_interface_ordering'), + ] + + operations = [ + # Missed type "other" in the initial migration (see #3967) + migrations.RunPython( + code=interfacetemplate_type_to_slug + ), + ]