Cannot edit a firewall rule with protocol 'ANY'

Bug #1324382 reported by Gary Duan
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Cedric Brandily

Bug Description

This issue can be reproduced in Havana and IceHouse release.

Create a Neutron Firewall Rule, select protocol field as 'ANY', then try to edit this rule by clicking 'Edit Rule' button. An error message pops up, read 'Error: An error occurred. Please try again later.'

Edit a firewall rule with protocol ANY should be allowed.

Revision history for this message
Julie Pichon (jpichon) wrote :

Could you include the content of the apache logs when the error happens?

Changed in horizon:
status: New → Incomplete
Revision history for this message
Gary Duan (gduan) wrote :

[Fri May 30 02:24:34 2014] [error]
[Fri May 30 02:24:44 2014] [error] Internal Server Error: /project/firewalls/updaterule/448916d9-7a9a-4371-9193-b5a159ea7f1a/
[Fri May 30 02:24:44 2014] [error] Traceback (most recent call last):
[Fri May 30 02:24:44 2014] [error] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 115, in get_response
[Fri May 30 02:24:44 2014] [error] response = callback(request, *callback_args, **callback_kwargs)
[Fri May 30 02:24:44 2014] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py", line 38, in dec
[Fri May 30 02:24:44 2014] [error] return view_func(request, *args, **kwargs)
[Fri May 30 02:24:44 2014] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py", line 54, in dec
[Fri May 30 02:24:44 2014] [error] return view_func(request, *args, **kwargs)
[Fri May 30 02:24:44 2014] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py", line 38, in dec
[Fri May 30 02:24:44 2014] [error] return view_func(request, *args, **kwargs)
[Fri May 30 02:24:44 2014] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py", line 86, in dec
[Fri May 30 02:24:44 2014] [error] return view_func(request, *args, **kwargs)
[Fri May 30 02:24:44 2014] [error] File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 68, in view
[Fri May 30 02:24:44 2014] [error] return self.dispatch(request, *args, **kwargs)
[Fri May 30 02:24:44 2014] [error] File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 86, in dispatch
[Fri May 30 02:24:44 2014] [error] return handler(request, *args, **kwargs)
[Fri May 30 02:24:44 2014] [error] File "/usr/local/lib/python2.7/dist-packages/django/views/generic/edit.py", line 154, in get
[Fri May 30 02:24:44 2014] [error] form = self.get_form(form_class)
[Fri May 30 02:24:44 2014] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/forms/views.py", line 87, in get_form
[Fri May 30 02:24:44 2014] [error] return form_class(self.request, **self.get_form_kwargs())
[Fri May 30 02:24:44 2014] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/project/firewalls/forms.py", line 78, in __init__
[Fri May 30 02:24:44 2014] [error] protocol = kwargs['initial']['protocol'].upper()
[Fri May 30 02:24:44 2014] [error] AttributeError: 'NoneType' object has no attribute 'upper'

Changed in horizon:
assignee: nobody → Gary Duan (gduan)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/96654

Changed in horizon:
status: Incomplete → In Progress
Revision history for this message
Gary Duan (gduan) wrote : Re: Cannot edit a firewll rule with protocol 'ANY'

Havana and IceHouse release need to be fixed too. Should I submit separated reviews?

Changed in neutron:
assignee: nobody → Gary Duan (gduan)
no longer affects: neutron
Revision history for this message
David Lyle (david-lyle) wrote :

We can backport the fix by cherrypicking once the fix for this merges on master.

Changed in horizon:
assignee: Gary Duan (gduan) → Cedric Brandily (cbrandily)
summary: - Cannot edit a firewll rule with protocol 'ANY'
+ Cannot edit a firewall rule with protocol 'ANY'
Revision history for this message
Cedric Brandily (cbrandily) wrote :

protocol 'ANY' is translated into protocol == None.

Editing a protocol 'ANY' rule implies kwargs['initial']['protocol'] == None

Revision history for this message
Cedric Brandily (cbrandily) wrote :

In such case we should replace None by ANY

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/122134

David Lyle (david-lyle)
Changed in horizon:
milestone: none → juno-rc1
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/122134
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=ede62824b8dc6587723e2f91db05e011e0e9b35f
Submitter: Jenkins
Branch: master

commit ede62824b8dc6587723e2f91db05e011e0e9b35f
Author: Cedric Brandily <email address hidden>
Date: Wed Sep 17 14:03:18 2014 +0200

    Handle correctly protocol 'ANY' in firewall rule

    Currently horizon allows to create firewall rule with protocol == 'ANY'
    but horizon crashs if you try to update such rule because UpdateRule
    assumes that protocol is a string and fails to convert it to uppercase
    if protocol is ANY/None. Moreover horizon does not allow to update
    protocol to 'ANY' despite neutron supports it.

    This change updates UpdateRule in order to convert correctly ANY to
    None and vice versa. It allows also to update firewall rule protocol to
    ANY.

    Closes-Bug: #1324382
    Closes-Bug: #1370485
    Change-Id: I5748b8e6c1cf0ef0d7a4317016492e064b5e8918

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: juno-rc1 → 2014.2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by David Lyle (<email address hidden>) on branch: master
Review: https://review.openstack.org/96654
Reason: This review is > 4 weeks without comment and currently blocked by a core reviewer with a -2. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and contacting the reviewer with the -2 on this review to ensure you address their concerns.

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.