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

assign-vlans view throws error on virtual machines where the cluster has no site #2214

Closed
kasimon opened this issue Jul 3, 2018 · 0 comments
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@kasimon
Copy link

kasimon commented Jul 3, 2018

Issue type

[ ] Feature request
[X] Bug report
[ ] Documentation
[ ] Housekeeping

Environment

  • Python version: 2.7.13
  • NetBox version: 2.3.5

Description

When trying to assign a vlan to an interface of a virtual machine where the cluster has no site set, a server error happens:

 Server Error
There was a problem with your request. Please contact an administrator.
The complete exception is provided below:

'NoneType' object has no attribute 'name'
If further assistance is required, please post to the NetBox mailing list.

The url is netbox/dcim/interfaces/447/assign-vlans/?return_url=/netbox/virtualization/vm-interfaces/447/edit/

The problem seems to be this line: https://github.com/digitalocean/netbox/blob/97863115ba2f8e889b8741099c5b1a6eb0a2051b/netbox/dcim/forms.py#L1784

Here is the stack trace:

Environment:


Request Method: GET
Request URL: http://REDACTED/netbox/dcim/interfaces/447/assign-vlans/?return_url=/netbox/virtualization/vm-interfaces/447/edit/

Django Version: 1.11.14
Python Version: 2.7.13
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'corsheaders',
 'debug_toolbar',
 'django_filters',
 'django_tables2',
 'mptt',
 'rest_framework',
 'timezone_field',
 'circuits',
 'dcim',
 'ipam',
 'extras',
 'secrets',
 'tenancy',
 'users',
 'utilities',
 'virtualization',
 'drf_yasg')
Installed Middleware:
('debug_toolbar.middleware.DebugToolbarMiddleware',
 'corsheaders.middleware.CorsMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'utilities.middleware.ExceptionHandlingMiddleware',
 'utilities.middleware.LoginRequiredMiddleware',
 'utilities.middleware.APIVersionMiddleware')



Traceback:

File "/opt/venvs/netbox/local/lib/python2.7/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/opt/venvs/netbox/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/opt/venvs/netbox/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/opt/venvs/netbox/local/lib/python2.7/site-packages/django/views/generic/base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)

File "/opt/venvs/netbox/local/lib/python2.7/site-packages/django/contrib/auth/mixins.py" in dispatch
  92.         return super(PermissionRequiredMixin, self).dispatch(request, *args, **kwargs)

File "/opt/venvs/netbox/local/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  88.         return handler(request, *args, **kwargs)

File "/opt/netbox/netbox/utilities/views.py" in get
  179.         form = self.model_form(instance=obj, initial=initial_data)

File "/opt/netbox/netbox/dcim/forms.py" in __init__
  1784.             vlan_choices.append((parent.site.name, [(vlan.pk, vlan) for vlan in site_vlans]))

Exception Type: AttributeError at /netbox/dcim/interfaces/447/assign-vlans/
Exception Value: 'NoneType' object has no attribute 'name'
@jeremystretch jeremystretch added type: bug A confirmed report of unexpected behavior in the application status: accepted This issue has been accepted for implementation labels Jul 5, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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