[2.3] 500 error when clicking the 'Upload' button with no script selected.

Bug #1712423 reported by Newell Jensen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Lee Trager

Bug Description

Steps to reproduce:

1. Go to Settings tab and click on 'Upload script' in the 'Commissioning scripts' section.
2. Click on 'Upload' button (without uploading a script).

500 stacktrace is produced:

==> /var/log/maas/regiond.log <==
2017-08-22 12:34:12 regiond: [info] ::1 GET /MAAS/rpc/ HTTP/1.0 --> 200 OK (referrer: -; agent: provisioningserver.rpc.clusterservice.ClusterClientService)
2017-08-22 12:34:16 maasserver.utils.views: [error] 500 Internal Server Error @ /MAAS/commissioning-scripts/add/
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python3/dist-packages/maasserver/utils/views.py", line 185, in view_atomic_with_post_commit_savepoint
    return view_atomic(*args, **kwargs)
  File "/usr/lib/python3.5/contextlib.py", line 30, in inner
    return func(*args, **kwds)
  File "/usr/lib/python3/dist-packages/django/contrib/auth/decorators.py", line 22, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/django/views/generic/base.py", line 89, in dispatch
    return handler(request, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/django/views/generic/edit.py", line 249, in post
    return super(BaseCreateView, self).post(request, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/django/views/generic/edit.py", line 214, in post
    if form.is_valid():
  File "/usr/lib/python3/dist-packages/maasserver/forms/script.py", line 431, in is_valid
    if not self._form.is_valid():
AttributeError: 'CommissioningScriptForm' object has no attribute '_form'
2017-08-22 12:34:16 regiond: [info] ::1 POST /MAAS/commissioning-scripts/add/ HTTP/1.1 --> 500 INTERNAL_SERVER_ERROR (referrer: http://192.168.122.10/MAAS/commissioning-scripts/add/; agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36)

Related branches

Revision history for this message
Lee Trager (ltrager) wrote :

The solution here is the form should disable the 'upload' button until a file is selected.

summary: - 500 error when trying to upload commissioning script
+ [2.3] 500 error when trying to upload commissioning script
Changed in maas:
assignee: nobody → Lee Trager (ltrager)
Revision history for this message
Andres Rodriguez (andreserl) wrote : Re: [2.3] 500 error when clicking the upload button having a script to upload

what happens in the api when you give an empty script? If the error shows, then the fix is not a UI fix, but rather a backend fix... which seems to be the case.

Changed in maas:
importance: Critical → High
assignee: Lee Trager (ltrager) → nobody
summary: - [2.3] 500 error when trying to upload commissioning script
+ [2.3] 500 error when clicking the upload button having a script to
+ upload
summary: - [2.3] 500 error when clicking the upload button having a script to
- upload
+ [2.3] 500 error when clicking the 'Upload' button with no script
+ selected.
description: updated
Changed in maas:
milestone: 2.3.0alpha2 → 2.3.0
Lee Trager (ltrager)
Changed in maas:
status: Confirmed → In Progress
assignee: nobody → Lee Trager (ltrager)
Changed in maas:
status: In Progress → Fix Committed
Changed in maas:
milestone: 2.3.0 → 2.3.0alpha3
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.