Security group rule - Other protocol

Bug #1789402 reported by Aleksey Myltsev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Akihiro Motoki

Bug Description

Queens, horizon 13.0.1
If try to create rule with other ip protocol then exception rise.
Cause of problem in openstack_dashboard/api/neutron.py
https://github.com/openstack/horizon/blob/841bce062327d70fb834b99bc2f238323e400a51/openstack_dashboard/api/neutron.py#L418-L441

If we define ip_protocol it mean that we didn't define to_port and from_port.
It means that comparison default values of to_port/from_port(None) with 0 will rise exception.

It can be fixed with something like this:
         if not cidr:
            cidr = None
+ if from_port != None:
            if from_port < 0:
                from_port = None
+ if to_port != None:
            if to_port < 0:
                to_port = None

description: updated
description: updated
Ivan Kolodyazhny (e0ne)
tags: added: queens-backport-potential
Changed in horizon:
status: New → Confirmed
importance: Undecided → Medium
Akihiro Motoki (amotoki)
tags: added: neutron
Revision history for this message
Akihiro Motoki (amotoki) wrote :

Do you use python3?

In python2 a comparison "None < 0" returns True, but python3 raises TypeError for this comparison.

tipica@s26:~ [OS:admin/admin@s26][00:02:28]$ python2.7
Python 2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> None < 0
True
>>>
tipica@s26:~ [OS:admin/admin@s26][00:02:39]$ python3.5
Python 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> None < 0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unorderable types: NoneType() < int()
>>>

tags: added: python3
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/627045

Changed in horizon:
assignee: nobody → Akihiro Motoki (amotoki)
status: Confirmed → In Progress
Akihiro Motoki (amotoki)
tags: removed: neutron
Revision history for this message
Aleksey Myltsev (amyltsev) wrote :

Yes, it was python3

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

Reviewed: https://review.openstack.org/627045
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=ccb21ca7a9906523a972e32df904744885183234
Submitter: Zuul
Branch: master

commit ccb21ca7a9906523a972e32df904744885183234
Author: Akihiro Motoki <email address hidden>
Date: Sun Dec 23 00:36:44 2018 +0900

    python3: Fix handling of other protocol in SG rule

    In python3 we cannot compare None with an integer,
    while this works in python2.

    Change-Id: I1321ea68f08241db377a58ed6a22306c63aba204
    Closes-Bug: #1789402

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 15.0.0.0b2

This issue was fixed in the openstack/horizon 15.0.0.0b2 development milestone.

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.