Invalid cidr in security group create raises "ERROR: local variable 'ip' referenced before assignment (HTTP 400)"

Bug #957708 reported by Anthony Young on 2012-03-17
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Low
MotoKen

Bug Description

To reproduce:

> nova secgroup-add-rule default tcp 55 55 0.0.0.8888/0

Expected:

Invalid cidr message

Actual:

$ nova secgroup-add-rule default tcp 55 55 0.0.0.8888/0
ERROR: local variable 'ip' referenced before assignment (HTTP 400)

This fails for ec2 as well:

$ euca-authorize -P tcp -p 22 default -s 0.232.3333.3/0
UnknownError: An unknown error has occurred. Please try your request again.

2012-03-16 22:59:46 ERROR nova.api.ec2 [req-299c6e98-213e-4680-a188-aa7399904924 b399a42284c4438db639d41fc2530baa c4ab6c17bc4742298838bd9c6fbc41e1] Unexpected error raised: local variable 'ip' referenced before assignment
(nova.api.ec2): TRACE: Traceback (most recent call last):
(nova.api.ec2): TRACE: File "/opt/stack/nova/nova/api/ec2/__init__.py", line 582, in __call__
(nova.api.ec2): TRACE: result = api_request.invoke(context)
(nova.api.ec2): TRACE: File "/opt/stack/nova/nova/api/ec2/apirequest.py", line 81, in invoke
(nova.api.ec2): TRACE: result = method(context, **args)
(nova.api.ec2): TRACE: File "/opt/stack/nova/nova/api/ec2/cloud.py", line 715, in authorize_security_group_ingress
(nova.api.ec2): TRACE: rulesvalues = self._rule_args_to_dict(context, values)
(nova.api.ec2): TRACE: File "/opt/stack/nova/nova/api/ec2/cloud.py", line 482, in _rule_args_to_dict
(nova.api.ec2): TRACE: rule = self._rule_dict_last_step(context, **kwargs)
(nova.api.ec2): TRACE: File "/opt/stack/nova/nova/api/ec2/cloud.py", line 550, in _rule_dict_last_step
(nova.api.ec2): TRACE: if not utils.is_valid_cidr(cidr_ip):
(nova.api.ec2): TRACE: File "/opt/stack/nova/nova/utils.py", line 1219, in is_valid_cidr
(nova.api.ec2): TRACE: netaddr.IPNetwork(address)
(nova.api.ec2): TRACE: File "/usr/lib/python2.7/dist-packages/netaddr/ip/__init__.py", line 919, in __init__
(nova.api.ec2): TRACE: implicit_prefix, flags)
(nova.api.ec2): TRACE: File "/usr/lib/python2.7/dist-packages/netaddr/ip/__init__.py", line 782, in parse_ip_network
(nova.api.ec2): TRACE: value = ip._value
(nova.api.ec2): TRACE: UnboundLocalError: local variable 'ip' referenced before assignment
(nova.api.ec2): TRACE:

Changed in nova:
importance: Undecided → Low
status: New → Triaged
tags: added: essex-rc-potential

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

Changed in nova:
assignee: nobody → MotoKen (motokentsai)
status: Triaged → In Progress

Reviewed: https://review.openstack.org/5551
Committed: http://github.com/openstack/nova/commit/d4234242bb810d7840ec7e2c4c9f877f53b2210b
Submitter: Jenkins
Branch: master

commit d4234242bb810d7840ec7e2c4c9f877f53b2210b
Author: MotoKen <email address hidden>
Date: Tue Mar 20 13:46:38 2012 +0800

    Fixes bug 957708.

    Work around bug in netaddr 0.7.5
    https://github.com/drkjam/netaddr/issues/2

    Change-Id: I3e064860c3865d5029481e6d63c5284d275a0081

Changed in nova:
status: In Progress → Fix Committed

Reviewed: https://review.openstack.org/6025
Committed: http://github.com/openstack/nova/commit/649bcc536a0c3957cf8d691ff69113dcbe78a6e0
Submitter: Jenkins
Branch: milestone-proposed

commit 649bcc536a0c3957cf8d691ff69113dcbe78a6e0
Author: MotoKen <email address hidden>
Date: Tue Mar 20 13:46:38 2012 +0800

    Fixes bug 957708.

    Work around bug in netaddr 0.7.5
    https://github.com/drkjam/netaddr/issues/2

    Change-Id: I3e064860c3865d5029481e6d63c5284d275a0081

Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2012-04-05
Changed in nova:
milestone: none → 2012.1

Reviewed: https://review.openstack.org/139669
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=373c581433472b2486e3015e1982bee032ef5656
Submitter: Jenkins
Branch: master

commit 373c581433472b2486e3015e1982bee032ef5656
Author: Krisztian Gacsal <email address hidden>
Date: Fri Dec 5 16:51:39 2014 +0100

    Remove needless workaround in utils module

    Workaround for bug in netaddr library has been removed due to the fix
    was introduced in 0.7.6 and nova currently requires 0.7.12 or newer version.

    Change-Id: If83cd8ee770d57547f4cfcdbba4a9fbfd55d5983
    Related-Bug: #957708

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers