Exception raised when cable trace ends at a rear port with no peer front port #4315

Closed
opened 2025-12-29 18:34:42 +01:00 by adam · 6 comments
Owner

Originally created by @ThomasADavis on GitHub (Nov 30, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version:

python3.6

  • NetBox version:

v2.10-beta1

Steps to Reproduce

  1. install v2.10
  2. use existing v2.9.9 db.
  3. errors out.

Expected Behavior

install completed.

Observed Behavior

Retracing 1652 cabled interfaces...
  1000
Traceback (most recent call last):
  File "netbox/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/netbox-2.10-beta1/venv/lib64/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/opt/netbox-2.10-beta1/venv/lib64/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/netbox-2.10-beta1/venv/lib64/python3.6/site-packages/django/core/management/base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/netbox-2.10-beta1/venv/lib64/python3.6/site-packages/django/core/management/base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "/opt/netbox-2.10-beta1/netbox/dcim/management/commands/trace_paths.py", line 75, in handle
    create_cablepath(obj)
  File "/opt/netbox-2.10-beta1/netbox/dcim/signals.py", line 16, in create_cablepath
    cp = CablePath.from_origin(node)
  File "/opt/netbox-2.10-beta1/netbox/dcim/models/cables.py", line 422, in from_origin
    node = FrontPort.objects.get(rear_port=peer_termination, rear_port_position=position)
  File "/opt/netbox-2.10-beta1/venv/lib64/python3.6/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/opt/netbox-2.10-beta1/venv/lib64/python3.6/site-packages/cacheops/query.py", line 353, in get
    return qs._no_monkey.get(qs, *args, **kwargs)
  File "/opt/netbox-2.10-beta1/venv/lib64/python3.6/site-packages/django/db/models/query.py", line 431, in get
    self.model._meta.object_name
dcim.models.device_components.DoesNotExist: FrontPort matching query does not exist.
[root@netbox-dev netbox]# 
Originally created by @ThomasADavis on GitHub (Nov 30, 2020). Originally assigned to: @jeremystretch on GitHub. <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/g/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report, and that any plugins have been disabled. --> ### Environment * Python version: python3.6 * NetBox version: v2.10-beta1 <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox. Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a client library such as pynetbox. --> ### Steps to Reproduce 1. install v2.10 2. use existing v2.9.9 db. 3. errors out. <!-- What did you expect to happen? --> ### Expected Behavior install completed. <!-- What happened instead? --> ### Observed Behavior ``` Retracing 1652 cabled interfaces... 1000 Traceback (most recent call last): File "netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/netbox-2.10-beta1/venv/lib64/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/opt/netbox-2.10-beta1/venv/lib64/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/netbox-2.10-beta1/venv/lib64/python3.6/site-packages/django/core/management/base.py", line 330, in run_from_argv self.execute(*args, **cmd_options) File "/opt/netbox-2.10-beta1/venv/lib64/python3.6/site-packages/django/core/management/base.py", line 371, in execute output = self.handle(*args, **options) File "/opt/netbox-2.10-beta1/netbox/dcim/management/commands/trace_paths.py", line 75, in handle create_cablepath(obj) File "/opt/netbox-2.10-beta1/netbox/dcim/signals.py", line 16, in create_cablepath cp = CablePath.from_origin(node) File "/opt/netbox-2.10-beta1/netbox/dcim/models/cables.py", line 422, in from_origin node = FrontPort.objects.get(rear_port=peer_termination, rear_port_position=position) File "/opt/netbox-2.10-beta1/venv/lib64/python3.6/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/opt/netbox-2.10-beta1/venv/lib64/python3.6/site-packages/cacheops/query.py", line 353, in get return qs._no_monkey.get(qs, *args, **kwargs) File "/opt/netbox-2.10-beta1/venv/lib64/python3.6/site-packages/django/db/models/query.py", line 431, in get self.model._meta.object_name dcim.models.device_components.DoesNotExist: FrontPort matching query does not exist. [root@netbox-dev netbox]# ```
adam added the type: bugstatus: acceptedbeta labels 2025-12-29 18:34:42 +01:00
adam closed this issue 2025-12-29 18:34:42 +01:00
Author
Owner

@jeremystretch commented on GitHub (Dec 1, 2020):

Can you determine the FrontPort instance causing the error? If you run ./manage.py nbshell and enter the following, it should give you the ID of the originating interface from the failed trace:

Interface.objects.filter(cable__isnull=False).first().pk

Then, you can navigate to http://netbox/dcim/interfaces/<id>/ to see what the interface is cabled to.

@jeremystretch commented on GitHub (Dec 1, 2020): Can you determine the FrontPort instance causing the error? If you run `./manage.py nbshell` and enter the following, it should give you the ID of the originating interface from the failed trace: ``` Interface.objects.filter(cable__isnull=False).first().pk ``` Then, you can navigate to `http://netbox/dcim/interfaces/<id>/` to see what the interface is cabled to.
Author
Owner

@ThomasADavis commented on GitHub (Dec 1, 2020):

I blew away that dev db, and re-created it from a 2.8.9 system, and it still occurs. I have not done anything more to this db.

Here's the results:

(venv) [root@netbox-dev netbox]# ./netbox/manage.py nbshell
### NetBox interactive shell (netbox-dev)
### Python 3.6.8 | Django 3.1.3 | NetBox 2.10-beta1
### lsmodels() will show available models. Use help(<model>) for more info.
>>> Interface.objects.filter(cable__isnull=False).first().pk
4585

Screen shots of both ends of 4585

Screenshot_2020-12-01_12-17-11
Screenshot_2020-12-01_12-16-49
Screenshot_2020-12-01_12-20-54
Screenshot_2020-12-01_12-30-03

@ThomasADavis commented on GitHub (Dec 1, 2020): I blew away that dev db, and re-created it from a 2.8.9 system, and it still occurs. I have *not* done anything more to this db. Here's the results: ``` (venv) [root@netbox-dev netbox]# ./netbox/manage.py nbshell ### NetBox interactive shell (netbox-dev) ### Python 3.6.8 | Django 3.1.3 | NetBox 2.10-beta1 ### lsmodels() will show available models. Use help(<model>) for more info. >>> Interface.objects.filter(cable__isnull=False).first().pk 4585 ``` Screen shots of both ends of 4585 ![Screenshot_2020-12-01_12-17-11](https://user-images.githubusercontent.com/12158973/100792219-2d86fc00-33cf-11eb-876f-0e29c3fb6bbc.png) ![Screenshot_2020-12-01_12-16-49](https://user-images.githubusercontent.com/12158973/100792221-2e1f9280-33cf-11eb-95b8-36afd9b9bb58.png) ![Screenshot_2020-12-01_12-20-54](https://user-images.githubusercontent.com/12158973/100792590-b2721580-33cf-11eb-8076-2c89e650fc42.png) ![Screenshot_2020-12-01_12-30-03](https://user-images.githubusercontent.com/12158973/100793464-fade0300-33d0-11eb-8a0a-5bf7438d574a.png)
Author
Owner

@jeremystretch commented on GitHub (Dec 2, 2020):

My apologies, I gave you an incorrect query to run. Please try the following:

Interface.objects.filter(cable__isnull=False, _path__isnull=True).first().pk

This should reveal the originating interface which results in the failed trace.

@jeremystretch commented on GitHub (Dec 2, 2020): My apologies, I gave you an incorrect query to run. Please try the following: ``` Interface.objects.filter(cable__isnull=False, _path__isnull=True).first().pk ``` This should reveal the originating interface which results in the failed trace.
Author
Owner

@ThomasADavis commented on GitHub (Dec 2, 2020):

ah. it's a hydra cable into a patch panel, then a trunk to another patch panel.. and it ends there. there is only 1 device attached, and the other end is waiting to be used.

Screenshot_2020-12-02_07-58-55
Screenshot_2020-12-02_08-00-14

@ThomasADavis commented on GitHub (Dec 2, 2020): ah. it's a hydra cable into a patch panel, then a trunk to another patch panel.. and it ends there. there is only 1 device attached, and the other end is waiting to be used. ![Screenshot_2020-12-02_07-58-55](https://user-images.githubusercontent.com/12158973/100897676-cb80d200-3474-11eb-9fdd-424bd7675df6.png) ![Screenshot_2020-12-02_08-00-14](https://user-images.githubusercontent.com/12158973/100897589-b015c700-3474-11eb-9053-b1d5b2995ea1.png)
Author
Owner

@jeremystretch commented on GitHub (Dec 2, 2020):

Thanks! I've been able to reproduce the bug locally. It seems to be caused by the absence of a front port associated with the ending rear port, but it should be easy enough to work around.

@jeremystretch commented on GitHub (Dec 2, 2020): Thanks! I've been able to reproduce the bug locally. It seems to be caused by the absence of a front port associated with the ending rear port, but it should be easy enough to work around.
Author
Owner

@jeremystretch commented on GitHub (Dec 2, 2020):

Should have it fixed now. You can clone the develop-2.10 branch to test, or just wait for the v2.10-beta2 release later this week. Please let me know if you still encounter issues after that.

@jeremystretch commented on GitHub (Dec 2, 2020): Should have it fixed now. You can clone the `develop-2.10` branch to test, or just wait for the v2.10-beta2 release later this week. Please let me know if you still encounter issues after that.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4315