diff --git a/CHANGELOG.md b/CHANGELOG.md index cd5cfaa..31284e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.1.6 (2023-09-08) + +* Fix migrations NetBox 3.6.0 + ## 0.1.5 (2023-09-08) * Fix for NetBox 3.6.0 diff --git a/netbox_napalm_plugin/__init__.py b/netbox_napalm_plugin/__init__.py index db9e6f4..bdaabbb 100644 --- a/netbox_napalm_plugin/__init__.py +++ b/netbox_napalm_plugin/__init__.py @@ -2,7 +2,7 @@ __author__ = """Arthur Hanson""" __email__ = "ahanson@netboxlabs.com" -__version__ = "0.1.5" +__version__ = "0.1.6" from extras.plugins import PluginConfig diff --git a/netbox_napalm_plugin/migrations/0002_auto_20230215_1752.py b/netbox_napalm_plugin/migrations/0002_auto_20230215_1752.py index 64f0cee..a3a1001 100644 --- a/netbox_napalm_plugin/migrations/0002_auto_20230215_1752.py +++ b/netbox_napalm_plugin/migrations/0002_auto_20230215_1752.py @@ -1,28 +1,35 @@ # Generated by Django 4.1.5 on 2023-02-15 17:52 from django.db import migrations +from django.core.exceptions import FieldError def forwards_migrate_napalm(apps, schema_editor): Platform = apps.get_model("dcim", "Platform") - NapalmPlatformConfig = apps.get_model("netbox_napalm_plugin", "NapalmPlatformConfig") - qs = Platform.objects.all().exclude(napalm_driver__exact="") - for platform in qs: - NapalmPlatformConfig.objects.create( - platform=platform, - napalm_driver=platform.napalm_driver, - napalm_args=platform.napalm_args, - ) + try: + NapalmPlatformConfig = apps.get_model("netbox_napalm_plugin", "NapalmPlatformConfig") + qs = Platform.objects.all().exclude(napalm_driver__exact="") + for platform in qs: + NapalmPlatformConfig.objects.create( + platform=platform, + napalm_driver=platform.napalm_driver, + napalm_args=platform.napalm_args, + ) + except FieldError: + pass def reverse_migrate_napalm(apps, schema_editor): Platform = apps.get_model("dcim", "Platform") - NapalmPlatformConfig = apps.get_model("netbox_napalm_plugin", "NapalmPlatformConfig") - qs = Platform.objects.all().exclude(napalm_driver__exact="") - for platform in qs: - NapalmPlatformConfig.objects.delete( - platform=platform, - ) + try: + NapalmPlatformConfig = apps.get_model("netbox_napalm_plugin", "NapalmPlatformConfig") + qs = Platform.objects.all().exclude(napalm_driver__exact="") + for platform in qs: + NapalmPlatformConfig.objects.delete( + platform=platform, + ) + except FieldError: + pass class Migration(migrations.Migration): diff --git a/netbox_napalm_plugin/project-static/package.json b/netbox_napalm_plugin/project-static/package.json index 5a29119..149c3bd 100644 --- a/netbox_napalm_plugin/project-static/package.json +++ b/netbox_napalm_plugin/project-static/package.json @@ -1,6 +1,6 @@ { "name": "netbox_napalm_plugin", - "version": "0.1.5", + "version": "0.1.6", "description": "Napalm Plugin for NetBox", "main": "index.js", "author": "Arthur Hanson", diff --git a/setup.cfg b/setup.cfg index 52fd8e1..2205854 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,7 +30,7 @@ python = 3.8: py38, format, lint, build [bumpversion] -current_version = 0.1.5 +current_version = 0.1.6 commit = True tag = True diff --git a/setup.py b/setup.py index 2c4e47c..9358c0b 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,6 @@ packages=find_packages(include=['netbox_napalm_plugin', 'netbox_napalm_plugin.*']), test_suite='tests', url='https://github.com/netbox-community/netbox-napalm', - version='0.1.5', + version='0.1.6', zip_safe=False, )