Merge lp:~blake-rouse/maas/fix-1508072-and-1508076 into lp:maas/trunk

Proposed by Blake Rouse on 2015-10-20
Status: Merged
Approved by: Blake Rouse on 2015-10-20
Approved revision: 4384
Merged at revision: 4384
Proposed branch: lp:~blake-rouse/maas/fix-1508072-and-1508076
Merge into: lp:maas/trunk
Diff against target: 48 lines (+17/-4)
3 files modified
src/maasserver/models/partition.py (+10/-3)
src/maasserver/models/tests/test_partition.py (+6/-0)
src/maasserver/websockets/handlers/subnet.py (+1/-1)
To merge this branch: bzr merge lp:~blake-rouse/maas/fix-1508072-and-1508076
Reviewer Review Type Date Requested Status
Andres Rodriguez 2015-10-20 Approve on 2015-10-20
Review via email: mp+275050@code.launchpad.net

Commit message

Fix precache on subnet handler. Fix handling partition table being deleted before partitions.

To post a comment you must log in.
Andres Rodriguez (andreserl) wrote :

lgtm!

review: Approve
MAAS Lander (maas-lander) wrote :

The attempt to merge lp:~blake-rouse/maas/fix-1508072-and-1508076 into lp:maas failed. Below is the output from the failed tests.

Get:1 http://security.ubuntu.com trusty-security InRelease [64.4 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Get:2 http://nova.clouds.archive.ubuntu.com trusty-updates InRelease [64.4 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:3 http://security.ubuntu.com trusty-security/main Sources [97.6 kB]
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [240 kB]
Get:5 http://security.ubuntu.com trusty-security/universe Sources [31.0 kB]
Get:6 http://security.ubuntu.com trusty-security/main amd64 Packages [355 kB]
Get:7 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [140 kB]
Get:8 http://security.ubuntu.com trusty-security/universe amd64 Packages [117 kB]
Get:9 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [634 kB]
Get:10 http://security.ubuntu.com trusty-security/main Translation-en [193 kB]
Get:11 http://security.ubuntu.com trusty-security/universe Translation-en [68.3 kB]
Get:12 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [323 kB]
Get:13 http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en [307 kB]
Get:14 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en [170 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 2,805 kB in 4s (629 kB/s)

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

MAAS Lander (maas-lander) wrote :
Download full text (1.4 MiB)

The attempt to merge lp:~blake-rouse/maas/fix-1508072-and-1508076 into lp:maas failed. Below is the output from the failed tests.

Hit http://security.ubuntu.com trusty-security InRelease
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools git gjs ipython isc-dhcp-common libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm pep8 phantomjs postgresql pyflakes python-apt python-bson python-bzrlib python-convoy python-coverage python-crochet python-cssselect python-curtin python-dev python-distro-info python-django python-django-piston python-django-south python-djorm-ext-pgarray python-docutils python-extras python-fixtures python-flake8 python-formencode python-hivex python-httplib2 python-jinja2 python-jsonschema python-lxml python-mock python-netaddr python-netifaces python-nose python-oauth python-openssl python-paramiko python-pexpect python-pip python-pocket-lint python-psycopg2 python-pyinotify python-pyparsing python-seamicroclient python-simplejson python-simplestreams python-sphinx python-subunit python-tempita python-testresources python-testscenarios python-testtools python-twisted python-txtftp python-tz python-unittest2 python-virtualenv python-yaml python-zope.interface socat syslinux-common...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/models/partition.py'
2--- src/maasserver/models/partition.py 2015-10-15 19:36:22 +0000
3+++ src/maasserver/models/partition.py 2015-10-20 15:04:48 +0000
4@@ -300,7 +300,14 @@
5 def delete_partition_table(sender, instance, **kwargs):
6 """Delete the partition table if this is the last partition on the
7 partition table."""
8+ # Circular imports.
9+ from maasserver.models.partitiontable import PartitionTable
10 if sender == Partition:
11- partition_table = instance.partition_table
12- if partition_table.partitions.count() == 0:
13- partition_table.delete()
14+ try:
15+ partition_table = instance.partition_table
16+ except PartitionTable.DoesNotExist:
17+ # Partition table has already been removed nothing to do.
18+ return
19+ else:
20+ if partition_table.partitions.count() == 0:
21+ partition_table.delete()
22
23=== modified file 'src/maasserver/models/tests/test_partition.py'
24--- src/maasserver/models/tests/test_partition.py 2015-10-16 13:34:30 +0000
25+++ src/maasserver/models/tests/test_partition.py 2015-10-20 15:04:48 +0000
26@@ -356,3 +356,9 @@
27 self.assertIsNotNone(reload_object(partition1))
28 self.assertIsNotNone(reload_object(partition_table))
29 self.assertIsNone(reload_object(partition2))
30+
31+ def test_delete_partitiontable_before_partition_doesnt_raise_error(self):
32+ partition_table = factory.make_PartitionTable()
33+ factory.make_Partition(partition_table=partition_table)
34+ # Test is that no error is raised.
35+ partition_table.delete()
36
37=== modified file 'src/maasserver/websockets/handlers/subnet.py'
38--- src/maasserver/websockets/handlers/subnet.py 2015-10-02 19:19:15 +0000
39+++ src/maasserver/websockets/handlers/subnet.py 2015-10-20 15:04:48 +0000
40@@ -34,7 +34,7 @@
41 .prefetch_related('nodegroupinterface_set__nodegroup')
42 .prefetch_related('staticipaddress_set__user')
43 .prefetch_related(
44- 'staticipaddress_set__user__interface_set__node'))
45+ 'staticipaddress_set__interface_set__node'))
46 pk = 'id'
47 allowed_methods = ['list', 'get', 'set_active']
48 listen_channels = [