Merge lp:~blake-rouse/maas/external-dhcp-api-and-ui into lp:~maas-committers/maas/trunk

Proposed by Blake Rouse
Status: Merged
Approved by: Blake Rouse
Approved revision: no longer in the source branch.
Merged at revision: 4877
Proposed branch: lp:~blake-rouse/maas/external-dhcp-api-and-ui
Merge into: lp:~maas-committers/maas/trunk
Prerequisite: lp:~blake-rouse/maas/external-dhcp-model
Diff against target: 135 lines (+53/-6)
6 files modified
src/maasserver/api/vlans.py (+1/-0)
src/maasserver/migrations/builtin/maasserver/0049_add_external_dhcp_present_to_vlan.py (+2/-4)
src/maasserver/migrations/builtin/maasserver/0050_modify_external_dhcp_on_vlan.py (+40/-0)
src/maasserver/models/vlan.py (+3/-1)
src/maasserver/static/partials/vlan-details.html (+6/-0)
src/maasserver/websockets/handlers/tests/test_vlan.py (+1/-1)
To merge this branch: bzr merge lp:~blake-rouse/maas/external-dhcp-api-and-ui
Reviewer Review Type Date Requested Status
LaMont Jones (community) Approve
Review via email: mp+291029@code.launchpad.net

Commit message

Show external_dhcp over the API and on the VLAN details page. Allow saving the IP address of the external DHCP instead of whether it is present or not.

To post a comment you must log in.
Revision history for this message
LaMont Jones (lamont) wrote :

lgtm

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (1.1 MiB)

The attempt to merge lp:~blake-rouse/maas/external-dhcp-api-and-ui into lp:maas failed. Below is the output from the failed tests.

Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:2 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:4 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
    --no-install-recommends install apache2 archdetect-deb authbind bash 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 postgresql pxelinux python3-all python3-apt python3-bson python3-convoy python3-coverage python3-crochet python3-cssselect python3-curtin python3-dev python3-distro-info python3-django python3-django-nose python3-django-piston3 python3-dnspython python3-docutils python3-formencode python3-hivex python3-httplib2 python3-jinja2 python3-jsonschema python3-lxml python3-mock python3-netaddr python3-netifaces python3-oauth python3-oauthlib python3-openssl python3-paramiko python3-petname python3-pexpect python3-psycopg2 python3-pyinotify python3-pyparsing python3-pyvmomi python3-requests python3-seamicroclient python3-setuptools python3-simplestreams python3-sphinx python3-tempita python3-twisted python3-txtftp python3-tz python3-yaml python3-zope.interface python-bson python-crochet python-django python-django-piston python-djorm-ext-pgarray python-formencode python-lxml python-netaddr python-netifaces python-pocket-lint python-psycopg2 python-tempita python-twisted python-yaml socat syslinux-common tgt ubuntu-cloudimage-keyring wget xvfb
Reading package lists...
Building dependency tree...
Reading state information...
apache2 is already the newest version (2.4.18-1ubuntu1).
archdetect-deb is already the newest version (1.117ubuntu1).
authbind is already the newest version (2.1.1+nmu1).
bash is already the newest version (4.3-14ubuntu1).
bind9 is already the newest version (1:9.10.3.dfsg.P4-5).
bind9utils is already the newest version (1:9.10.3.dfsg.P4-5).
build-essential is already the newest version (12.1ubuntu2).
curl is already the newest version (7.47.0-1ubuntu2).
debhelper is already the newest version (9.20160115ubuntu3).
dh-apport is already the newest version (2.20.1-0ubuntu1).
dh-systemd is already the newest version (1.29ubuntu1).
distro-info is already the newest version (0.14build1).
dnsutils is already the newest version (1:9.10.3.dfsg.P4-5).
firefox is already the newest version (45.0.1+build1-0ubuntu1).
freeipmi-tools is already the newest version (1.4.11-1ubuntu1).
git is already the newest version (1:2.7.4-0ubuntu1).
isc-dhcp-common is already the newest version (4.3.3-5ubuntu11).
libjs-angularjs is already the newest version (1.2.28-1ubuntu2).
libjs-jquery is already the newest version (1.11.3+dfsg-4).
libjs-jquery-hotke...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/api/vlans.py'
2--- src/maasserver/api/vlans.py 2016-02-17 16:12:30 +0000
3+++ src/maasserver/api/vlans.py 2016-04-06 15:06:15 +0000
4@@ -25,6 +25,7 @@
5 'primary_rack',
6 'secondary_rack',
7 'dhcp_on',
8+ 'external_dhcp',
9 )
10
11
12
13=== modified file 'src/maasserver/migrations/builtin/maasserver/0049_add_external_dhcp_present_to_vlan.py'
14--- src/maasserver/migrations/builtin/maasserver/0049_add_external_dhcp_present_to_vlan.py 2016-04-05 19:06:56 +0000
15+++ src/maasserver/migrations/builtin/maasserver/0049_add_external_dhcp_present_to_vlan.py 2016-04-06 15:06:15 +0000
16@@ -6,8 +6,6 @@
17 models,
18 )
19 import django.db.models.deletion
20-import maasserver.models.interface
21-import maasserver.models.subnet
22
23
24 class Migration(migrations.Migration):
25@@ -25,11 +23,11 @@
26 migrations.AlterField(
27 model_name='interface',
28 name='vlan',
29- field=models.ForeignKey(to='maasserver.VLAN', on_delete=django.db.models.deletion.PROTECT, default=maasserver.models.interface.get_default_vlan),
30+ field=models.ForeignKey(to='maasserver.VLAN', on_delete=django.db.models.deletion.PROTECT, default=0),
31 ),
32 migrations.AlterField(
33 model_name='subnet',
34 name='vlan',
35- field=models.ForeignKey(to='maasserver.VLAN', on_delete=django.db.models.deletion.PROTECT, default=maasserver.models.subnet.get_default_vlan),
36+ field=models.ForeignKey(to='maasserver.VLAN', on_delete=django.db.models.deletion.PROTECT, default=0),
37 ),
38 ]
39
40=== added file 'src/maasserver/migrations/builtin/maasserver/0050_modify_external_dhcp_on_vlan.py'
41--- src/maasserver/migrations/builtin/maasserver/0050_modify_external_dhcp_on_vlan.py 1970-01-01 00:00:00 +0000
42+++ src/maasserver/migrations/builtin/maasserver/0050_modify_external_dhcp_on_vlan.py 2016-04-06 15:06:15 +0000
43@@ -0,0 +1,40 @@
44+# -*- coding: utf-8 -*-
45+from __future__ import unicode_literals
46+
47+from django.db import (
48+ migrations,
49+ models,
50+)
51+import django.db.models.deletion
52+import maasserver.fields
53+import maasserver.models.interface
54+import maasserver.models.subnet
55+
56+
57+class Migration(migrations.Migration):
58+
59+ dependencies = [
60+ ('maasserver', '0049_add_external_dhcp_present_to_vlan'),
61+ ]
62+
63+ operations = [
64+ migrations.RemoveField(
65+ model_name='vlan',
66+ name='external_dhcp_present',
67+ ),
68+ migrations.AddField(
69+ model_name='vlan',
70+ name='external_dhcp',
71+ field=maasserver.fields.MAASIPAddressField(null=True, editable=False, default=None, blank=True),
72+ ),
73+ migrations.AlterField(
74+ model_name='interface',
75+ name='vlan',
76+ field=models.ForeignKey(to='maasserver.VLAN', on_delete=django.db.models.deletion.PROTECT, default=maasserver.models.interface.get_default_vlan),
77+ ),
78+ migrations.AlterField(
79+ model_name='subnet',
80+ name='vlan',
81+ field=models.ForeignKey(to='maasserver.VLAN', on_delete=django.db.models.deletion.PROTECT, default=maasserver.models.subnet.get_default_vlan),
82+ ),
83+ ]
84
85=== modified file 'src/maasserver/models/vlan.py'
86--- src/maasserver/models/vlan.py 2016-04-05 16:36:13 +0000
87+++ src/maasserver/models/vlan.py 2016-04-06 15:06:15 +0000
88@@ -22,6 +22,7 @@
89 )
90 from django.db.models.query import QuerySet
91 from maasserver import DefaultMeta
92+from maasserver.fields import MAASIPAddressField
93 from maasserver.models.cleansave import CleanSave
94 from maasserver.models.fabric import Fabric
95 from maasserver.models.interface import VLANInterface
96@@ -162,7 +163,8 @@
97
98 dhcp_on = BooleanField(default=False, editable=True)
99
100- external_dhcp_present = BooleanField(default=False, editable=False)
101+ external_dhcp = MAASIPAddressField(
102+ null=True, editable=False, blank=True, default=None)
103
104 primary_rack = ForeignKey(
105 'RackController', null=True, blank=True, editable=True,
106
107=== modified file 'src/maasserver/static/partials/vlan-details.html'
108--- src/maasserver/static/partials/vlan-details.html 2016-03-28 13:54:47 +0000
109+++ src/maasserver/static/partials/vlan-details.html 2016-04-06 15:06:15 +0000
110@@ -175,6 +175,12 @@
111 </dl>
112 <dl class="six-col last-col">
113 <dt class="two-col">DHCP</dt><dd class="four-col last-col">{$ vlanDetails.vlan.dhcp_on ? "Enabled" : "Disabled" $}</dd>
114+ <div data-ng-if="vlanDetails.vlan.external_dhcp">
115+ <dt class="two-col">External DHCP</dt>
116+ <dd class="four-col last-col">{$ vlanDetails.vlan.external_dhcp $}
117+ <i class="icon warning tooltip" data-tooltip="Another DHCP server has been discovered on this VLAN. Enabling DHCP is not recommended."></i>
118+ </dd>
119+ </div>
120 <div class="ng-hide" data-ng-show="vlanDetails.primaryRack">
121 <dt class="two-col">Primary controller</dt><dd class="four-col last-col">{$ vlanDetails.primaryRack.hostname $}</dd>
122 </div>
123
124=== modified file 'src/maasserver/websockets/handlers/tests/test_vlan.py'
125--- src/maasserver/websockets/handlers/tests/test_vlan.py 2016-04-05 20:12:59 +0000
126+++ src/maasserver/websockets/handlers/tests/test_vlan.py 2016-04-06 15:06:15 +0000
127@@ -32,7 +32,7 @@
128 "updated": dehydrate_datetime(vlan.updated),
129 "created": dehydrate_datetime(vlan.created),
130 "dhcp_on": vlan.dhcp_on,
131- "external_dhcp_present": vlan.external_dhcp_present,
132+ "external_dhcp": vlan.external_dhcp,
133 "primary_rack": vlan.primary_rack,
134 "secondary_rack": vlan.secondary_rack,
135 "subnet_ids": sorted([