Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ThomasADavis opened this issue Nov 30, 2020 · 6 comments
Assignees
Labels
beta Concerns a bug/feature in a beta release status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@ThomasADavis
Copy link

ThomasADavis commented Nov 30, 2020

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]# 
@jeremystretch jeremystretch added beta Concerns a bug/feature in a beta release status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application labels Dec 1, 2020
@jeremystretch jeremystretch self-assigned this Dec 1, 2020
@jeremystretch
Copy link
Member

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.

@ThomasADavis
Copy link
Author

ThomasADavis commented 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

@jeremystretch
Copy link
Member

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.

@ThomasADavis
Copy link
Author

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

@jeremystretch
Copy link
Member

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 jeremystretch changed the title install error with v2.10beta-1, cable erroring.. Exception raised when cable trace ends at a rear port with no peer front port Dec 2, 2020
@jeremystretch
Copy link
Member

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
beta Concerns a bug/feature in a beta release status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

2 participants