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

Issues with showing child prefixes #7072

Closed
trrunde opened this issue Aug 30, 2021 · 13 comments
Closed

Issues with showing child prefixes #7072

trrunde opened this issue Aug 30, 2021 · 13 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@trrunde
Copy link

trrunde commented Aug 30, 2021

NetBox version

v3.0

Python version

3.8

Steps to Reproduce

In version 2.x I had added some more column to be visible on the prefixes. I believe it was "Tags"
after upgrading to version 3.0 I get the following error when clicking "child prefixes" on a prefix.

The complete exception is provided below:

<class 'AttributeError'>

'str' object has no attribute 'available_columns'

Python version: 3.8.6
NetBox version: 3.0.0

Expected Behavior

Page showing child prefixes

Observed Behavior

The complete exception is provided below:

<class 'AttributeError'>

'str' object has no attribute 'available_columns'

Python version: 3.8.6
NetBox version: 3.0.0

@trrunde trrunde added the type: bug A confirmed report of unexpected behavior in the application label Aug 30, 2021
@jeremystretch
Copy link
Member

Have you tried clearing out your table preferences (under your user profile)? Are you able to recreate this on v3.0.0 alone?

@jeremystretch jeremystretch added the status: revisions needed This issue requires additional information to be actionable label Aug 30, 2021
@rodvand
Copy link
Contributor

rodvand commented Aug 30, 2021

I am able to reproduce on my test instance, as well as the NetBox Beta Demo instance (https://beta-demo.netbox.dev/ipam/prefixes/1/) and click Child Prefixes. And I can't see any user preferences on my profile that should result in this (nothing related to prefix).

@jeremystretch
Copy link
Member

I am able to reproduce on my test instance

@rodvand can you please share the specific steps you're taking to reproduce the bug on v3.0.0?

@trrunde
Copy link
Author

trrunde commented Aug 30, 2021

Have you tried clearing out your table preferences (under your user profile)? Are you able to recreate this on v3.0.0 alone?

have not tested that, will check settings to clear my profile then adding the column back after.

@trrunde
Copy link
Author

trrunde commented Aug 30, 2021

Tried clearing the columns on my profile page, same result. Got some more details about the traceback error in the email sent from netbox.

`Request Method: GET
Request URL: https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fnetbox1.st3.lysetele.net%2Fipam%2Fprefixes%2F6295%2Fprefixes%2F&amp;data=04%7C01%7C%7Ce2ff14718fdf4e29206508d96bfd90d4%7C22ca942f06c24f3894070e447dedbb67%7C0%7C0%7C637659559214455220%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=onWYiTCdB%2BmGau0ZDMT%2BaKeqH5DozyqYhWGXUXpqazg%3D&amp;reserved=0
Django Version: 3.2.6
Python Executable: /opt/netbox/venv/bin/python3.8
Python Version: 3.8.6
Python Path: ['/opt/netbox/netbox', '/opt/netbox', '/opt/netbox/venv/bin', '/usr/lib64/python38.zip', '/usr/lib64/python3.8', '/usr/lib64/python3.8/lib-dynload', '/opt/netbox/venv/lib64/python3.8/site-packages', '/opt/netbox/venv/lib/python3.8/site-packages']
Server time: Mon, 30 Aug 2021 23:31:43 +0200
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',
'graphiql_debug_toolbar',
'django_filters',
'django_tables2',
'django_prometheus',
'graphene_django',
'mptt',
'rest_framework',
'taggit',
'timezone_field',
'circuits',
'dcim',
'ipam',
'extras',
'tenancy',
'users',
'utilities',
'virtualization',
'django_rq',
'drf_yasg']
Installed Middleware:
['graphiql_debug_toolbar.middleware.DebugToolbarMiddleware',
'django_prometheus.middleware.PrometheusBeforeMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'netbox.middleware.ExceptionHandlingMiddleware',
'netbox.middleware.RemoteUserMiddleware',
'netbox.middleware.LoginRequiredMiddleware',
'netbox.middleware.APIVersionMiddleware',
'netbox.middleware.ObjectChangeMiddleware',
'django_prometheus.middleware.PrometheusAfterMiddleware']

Traceback (most recent call last):
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/opt/netbox/netbox/utilities/views.py", line 93, in dispatch
return super().dispatch(request, *args, **kwargs)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/views/generic/base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "/opt/netbox/netbox/netbox/views/generic.py", line 70, in get
return render(request, self.get_template_name(), {
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/shortcuts.py", line 19, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/loader.py", line 62, in render_to_string
return template.render(context, request)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/backends/django.py", line 61, in render
return self.template.render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/base.py", line 170, in render
return self._render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/test/utils.py", line 100, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/loader_tags.py", line 150, in render
return compiled_parent._render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/test/utils.py", line 100, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/loader_tags.py", line 150, in render
return compiled_parent._render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/test/utils.py", line 100, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/loader_tags.py", line 150, in render
return compiled_parent._render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/test/utils.py", line 100, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/loader_tags.py", line 150, in render
return compiled_parent._render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/test/utils.py", line 100, in instrumented_test_render
return self.nodelist.render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/loader_tags.py", line 62, in render
result = block.nodelist.render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/loader_tags.py", line 62, in render
result = block.nodelist.render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/loader_tags.py", line 62, in render
result = block.nodelist.render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)
File "/opt/netbox/venv/lib64/python3.8/site-packages/django/template/library.py", line 214, in render
_dict = self.func(*resolved_args, **resolved_kwargs)
File "/opt/netbox/netbox/utilities/templatetags/helpers.py", line 404, in table_config_form
'table_config_form': TableConfigForm(table=table),
File "/opt/netbox/netbox/utilities/forms/forms.py", line 207, in init
self.fields['available_columns'].choices = table.available_columns

Exception Type: AttributeError at /ipam/prefixes/6295/prefixes/
Exception Value: 'str' object has no attribute 'available_columns'
Request information:
USER: trondar`

@trrunde
Copy link
Author

trrunde commented Aug 30, 2021

I am able to reproduce on my test instance

@rodvand can you please share the specific steps you're taking to reproduce the bug on v3.0.0?

Its enough to open a prefix, then click "child prefixes" This will lead to an error with 'str' object has no attribute 'available_columns'

@fkusei
Copy link

fkusei commented Aug 31, 2021

Can confirm the same issue. Was upgrading from 2.11.11 to 3.0.0, cleared user preferences after upgrading. Same error, same log entry.

Can provide a copy of my logs if needed.

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: revisions needed This issue requires additional information to be actionable labels Aug 31, 2021
@jeremystretch jeremystretch self-assigned this Aug 31, 2021
@jeremystretch
Copy link
Member

Table configuration for the child prefixes view just recently added in #6872 (in v2.11.12), but it seems to have broken in v3.0.

@jeremystretch
Copy link
Member

Looks like something got lost in the merge when we switched from a context variable to a template tag for the table configuration form.

@maznu
Copy link

maznu commented Aug 31, 2021

Seeing exactly the same issue. Glad someone's already reported it!

@casmith32
Copy link

I see that this has been closed. How do I apply the fix ? experiencing the same thing when showing child prefixes

The complete exception is provided below:
<class 'AttributeError'>
'str' object has no attribute 'available_columns'

Python version: 3.8.10
NetBox version: 3.0.0

@jeremystretch
Copy link
Member

@casmith32 it will be available in the v3.0.1 release, expected later today. Alternatively, you can clone the develop branch to pull in the current state (with the fix), however be aware that it may not be entirely stable.

@casmith32
Copy link

Great - we'll sit tight. not a show stopper rightnow

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 1, 2021
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

6 participants