From 9e855ac6cd169fdd56e0a57c14673db89c0b9a46 Mon Sep 17 00:00:00 2001 From: kobayashi Date: Tue, 21 Jan 2020 00:30:47 -0500 Subject: [PATCH 1/7] 3960 legacy device status --- docs/release-notes/version-2.7.md | 1 + netbox/templates/dcim/device.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-2.7.md b/docs/release-notes/version-2.7.md index ed9fdd28d..83e88cf59 100644 --- a/docs/release-notes/version-2.7.md +++ b/docs/release-notes/version-2.7.md @@ -10,6 +10,7 @@ * [#3721](https://github.com/netbox-community/netbox/issues/3721) - Allow Unicode characters in tag slugs * [#3951](https://github.com/netbox-community/netbox/issues/3951) - Fix exception in webhook worker due to missing constant * [#3953](https://github.com/netbox-community/netbox/issues/3953) - Fix validation error when creating child devices +* [#3960](https://github.com/netbox-community/netbox/issues/3960) - Fix legacy device status choice --- diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html index 883cefd32..fa37f1ac5 100644 --- a/netbox/templates/dcim/device.html +++ b/netbox/templates/dcim/device.html @@ -84,7 +84,7 @@ {% if perms.dcim.napalm_read %} - {% if device.status != 1 %} + {% if device.status != 'active' %} {% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='Device must be in active status' %} {% elif not device.platform %} {% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No platform assigned to this device' %} From 9d3215e806043745a02d7d031c144665a681d7c2 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 21 Jan 2020 09:32:51 -0500 Subject: [PATCH 2/7] Fixes #3967: Resolve migration of "other" interface type --- docs/release-notes/version-2.7.md | 1 + netbox/dcim/choices.py | 1 + .../migrations/0091_interface_type_other.py | 20 +++++++++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 netbox/dcim/migrations/0091_interface_type_other.py diff --git a/docs/release-notes/version-2.7.md b/docs/release-notes/version-2.7.md index ed9fdd28d..c9e8bf844 100644 --- a/docs/release-notes/version-2.7.md +++ b/docs/release-notes/version-2.7.md @@ -10,6 +10,7 @@ * [#3721](https://github.com/netbox-community/netbox/issues/3721) - Allow Unicode characters in tag slugs * [#3951](https://github.com/netbox-community/netbox/issues/3951) - Fix exception in webhook worker due to missing constant * [#3953](https://github.com/netbox-community/netbox/issues/3953) - Fix validation error when creating child devices +* [#3967](https://github.com/netbox-community/netbox/issues/3967) - Resolve migration of "other" interface type --- diff --git a/netbox/dcim/choices.py b/netbox/dcim/choices.py index 34bd8101b..6ceefa878 100644 --- a/netbox/dcim/choices.py +++ b/netbox/dcim/choices.py @@ -802,6 +802,7 @@ class InterfaceTypeChoices(ChoiceSet): TYPE_SUMMITSTACK128: 5310, TYPE_SUMMITSTACK256: 5320, TYPE_SUMMITSTACK512: 5330, + TYPE_OTHER: 32767, } diff --git a/netbox/dcim/migrations/0091_interface_type_other.py b/netbox/dcim/migrations/0091_interface_type_other.py new file mode 100644 index 000000000..1ea24885f --- /dev/null +++ b/netbox/dcim/migrations/0091_interface_type_other.py @@ -0,0 +1,20 @@ +from django.db import migrations + + +def interface_type_to_slug(apps, schema_editor): + Interface = apps.get_model('dcim', 'Interface') + Interface.objects.filter(type=32767).update(type='other') + + +class Migration(migrations.Migration): + + dependencies = [ + ('dcim', '0090_cable_termination_models'), + ] + + operations = [ + # Missed type "other" in the initial migration (see #3967) + migrations.RunPython( + code=interface_type_to_slug + ), + ] From eb7fbe4b3aaff75375cdf204c2fbc8544fd9690e Mon Sep 17 00:00:00 2001 From: hellerve Date: Tue, 21 Jan 2020 15:33:17 +0100 Subject: [PATCH 3/7] dcim: fix #3962 by moving away from device.name --- netbox/dcim/models/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/dcim/models/__init__.py b/netbox/dcim/models/__init__.py index 4ff15141c..d8a0491ea 100644 --- a/netbox/dcim/models/__init__.py +++ b/netbox/dcim/models/__init__.py @@ -397,12 +397,12 @@ class RackElevationHelperMixin: ) link.add(drawing.rect(start, end, fill='#{}'.format(color))) hex_color = '#{}'.format(foreground_color(color)) - link.add(drawing.text(device.name, insert=text, fill=hex_color)) + link.add(drawing.text(str(device), insert=text, fill=hex_color)) @staticmethod def _draw_device_rear(drawing, device, start, end, text): drawing.add(drawing.rect(start, end, class_="blocked")) - drawing.add(drawing.text(device.name, insert=text)) + drawing.add(drawing.text(str(device), insert=text)) @staticmethod def _draw_empty(drawing, rack, start, end, text, id_, face_id, class_): From 1a56a5561ce81367ed9902b02f1d7d2e726e3b65 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 21 Jan 2020 09:41:55 -0500 Subject: [PATCH 4/7] Add systemd migration doc to pages list --- mkdocs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/mkdocs.yml b/mkdocs.yml index 686c04a1d..5e2179eb3 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -12,6 +12,7 @@ pages: - 4. LDAP (Optional): 'installation/4-ldap.md' - Upgrading NetBox: 'installation/upgrading.md' - Migrating to Python3: 'installation/migrating-to-python3.md' + - Migrating to systemd: 'installation/migrating-to-systemd.md' - Configuration: - Configuring NetBox: 'configuration/index.md' - Required Settings: 'configuration/required-settings.md' From 63dbee16ccf45ed45e6cbd3d5c8f169f1a2c171e Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 21 Jan 2020 10:11:27 -0500 Subject: [PATCH 5/7] Changelog for #3962 --- docs/release-notes/version-2.7.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/version-2.7.md b/docs/release-notes/version-2.7.md index 1be984090..ce98ef6ff 100644 --- a/docs/release-notes/version-2.7.md +++ b/docs/release-notes/version-2.7.md @@ -11,6 +11,7 @@ * [#3951](https://github.com/netbox-community/netbox/issues/3951) - Fix exception in webhook worker due to missing constant * [#3953](https://github.com/netbox-community/netbox/issues/3953) - Fix validation error when creating child devices * [#3960](https://github.com/netbox-community/netbox/issues/3960) - Fix legacy device status choice +* [#3962](https://github.com/netbox-community/netbox/issues/3962) - Fix display of unnamed devices in rack elevations * [#3967](https://github.com/netbox-community/netbox/issues/3967) - Resolve migration of "other" interface type --- From 469a08887431df0563e5df3007b02badcf2d1eab Mon Sep 17 00:00:00 2001 From: hellerve Date: Tue, 21 Jan 2020 16:19:41 +0100 Subject: [PATCH 6/7] dcim: fix tooltips in svg rack display --- netbox/dcim/models/__init__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/netbox/dcim/models/__init__.py b/netbox/dcim/models/__init__.py index d8a0491ea..ed7c63dfa 100644 --- a/netbox/dcim/models/__init__.py +++ b/netbox/dcim/models/__init__.py @@ -395,13 +395,22 @@ class RackElevationHelperMixin: fill='black' ) ) + link.set_desc('{} — {} ({}U) {} {}'.format( + device.device_role, device.device_type.display_name, + device.device_type.u_height, device.asset_tag or '', device.serial or '' + )) link.add(drawing.rect(start, end, fill='#{}'.format(color))) hex_color = '#{}'.format(foreground_color(color)) link.add(drawing.text(str(device), insert=text, fill=hex_color)) @staticmethod def _draw_device_rear(drawing, device, start, end, text): - drawing.add(drawing.rect(start, end, class_="blocked")) + rect = drawing.rect(start, end, class_="blocked") + rect.set_desc('{} — {} ({}U) {} {}'.format( + device.device_role, device.device_type.display_name, + device.device_type.u_height, device.asset_tag or '', device.serial or '' + )) + drawing.add(rect) drawing.add(drawing.text(str(device), insert=text)) @staticmethod From 74e1c08324bbfff046080f4b5acbed03cb53d111 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 21 Jan 2020 11:35:05 -0500 Subject: [PATCH 7/7] Changelog for #3963 --- docs/release-notes/version-2.7.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/version-2.7.md b/docs/release-notes/version-2.7.md index ce98ef6ff..52c9d98f1 100644 --- a/docs/release-notes/version-2.7.md +++ b/docs/release-notes/version-2.7.md @@ -12,6 +12,7 @@ * [#3953](https://github.com/netbox-community/netbox/issues/3953) - Fix validation error when creating child devices * [#3960](https://github.com/netbox-community/netbox/issues/3960) - Fix legacy device status choice * [#3962](https://github.com/netbox-community/netbox/issues/3962) - Fix display of unnamed devices in rack elevations +* [#3963](https://github.com/netbox-community/netbox/issues/3963) - Restore tooltip for devices in rack elevations * [#3967](https://github.com/netbox-community/netbox/issues/3967) - Resolve migration of "other" interface type ---