Merge lp:~rackspace-titan/nova/nova-manage-address-not-found-lp831627 into lp:~hudson-openstack/nova/trunk

Proposed by Alex Meade
Status: Merged
Approved by: Brian Waldon
Approved revision: 1474
Merged at revision: 1475
Proposed branch: lp:~rackspace-titan/nova/nova-manage-address-not-found-lp831627
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 35 lines (+12/-0)
2 files modified
bin/nova-manage (+2/-0)
nova/tests/test_nova_manage.py (+10/-0)
To merge this branch: bzr merge lp:~rackspace-titan/nova/nova-manage-address-not-found-lp831627
Reviewer Review Type Date Requested Status
Brian Waldon (community) Approve
Devin Carlen (community) Approve
Review via email: mp+72501@code.launchpad.net

Description of the change

Fixes bug 831627 where nova-manage does not exit when given a non-existent network address

To post a comment you must log in.
Revision history for this message
Devin Carlen (devcamcar) wrote :

lgtm

review: Approve
Revision history for this message
Brian Waldon (bcwaldon) wrote :

Hardcore.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/nova-manage'
2--- bin/nova-manage 2011-08-15 20:33:37 +0000
3+++ bin/nova-manage 2011-08-22 21:41:25 +0000
4@@ -611,6 +611,8 @@
5
6 try:
7 fixed_ip = db.fixed_ip_get_by_address(ctxt, address)
8+ if fixed_ip is None:
9+ raise exception.NotFound('Could not find address')
10 db.fixed_ip_update(ctxt, fixed_ip['address'],
11 {'reserved': reserved})
12 except exception.NotFound as ex:
13
14=== modified file 'nova/tests/test_nova_manage.py'
15--- nova/tests/test_nova_manage.py 2011-08-22 20:39:05 +0000
16+++ nova/tests/test_nova_manage.py 2011-08-22 21:41:25 +0000
17@@ -55,8 +55,18 @@
18 '192.168.0.100')
19 self.assertEqual(address['reserved'], True)
20
21+ def test_reserve_nonexistent_address(self):
22+ self.assertRaises(SystemExit,
23+ self.commands.reserve,
24+ '55.55.55.55')
25+
26 def test_unreserve(self):
27 self.commands.unreserve('192.168.0.100')
28 address = db.fixed_ip_get_by_address(context.get_admin_context(),
29 '192.168.0.100')
30 self.assertEqual(address['reserved'], False)
31+
32+ def test_unreserve_nonexistent_address(self):
33+ self.assertRaises(SystemExit,
34+ self.commands.unreserve,
35+ '55.55.55.55')