Merge lp:~lamont/maas/bug-1589587 into lp:~maas-committers/maas/trunk

Proposed by LaMont Jones
Status: Merged
Approved by: LaMont Jones
Approved revision: no longer in the source branch.
Merged at revision: 5108
Proposed branch: lp:~lamont/maas/bug-1589587
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 187 lines (+30/-6)
10 files modified
src/maasserver/models/fabric.py (+2/-0)
src/maasserver/static/js/angular/controllers/node_details_networking.js (+1/-1)
src/maasserver/static/js/angular/controllers/subnet_details.js (+1/-1)
src/maasserver/static/js/angular/controllers/tests/test_fabric_details.js (+2/-0)
src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js (+14/-3)
src/maasserver/static/js/angular/controllers/tests/test_subnet_details.js (+1/-0)
src/maasserver/static/js/angular/controllers/tests/test_vlan_details.js (+1/-0)
src/maasserver/static/js/angular/controllers/vlan_details.js (+4/-1)
src/maasserver/websockets/handlers/fabric.py (+3/-0)
src/maasserver/websockets/handlers/tests/test_fabric.py (+1/-0)
To merge this branch: bzr merge lp:~lamont/maas/bug-1589587
Reviewer Review Type Date Requested Status
Blake Rouse (community) Approve
Review via email: mp+297058@code.launchpad.net

Commit message

On the details page for the default VLAN of a fabric, do not offer "Drop VLAN" as an action.

Description of the change

On the details page for the default VLAN of a fabric, do not offer "Drop VLAN" as an action.

To post a comment you must log in.
Revision history for this message
Blake Rouse (blake-rouse) wrote :

Looks good.

review: Approve
Revision history for this message
LaMont Jones (lamont) wrote :

replied to comment.

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

The attempt to merge lp:~lamont/maas/bug-1589587 into lp:maas failed. Below is the output from the failed tests.

Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Hit:2 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial InRelease
Get:3 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease [94.5 kB]
Hit:4 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease
Fetched 189 kB in 0s (389 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
    --no-install-recommends install apache2 archdetect-deb authbind bash bind9 bind9utils build-essential bzr 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-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-netaddr python3-netifaces python3-novaclient 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-simplejson 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-2ubuntu3).
archdetect-deb is already the newest version (1.117ubuntu2).
authbind is already the newest version (2.1.1+nmu1).
bash is already the newest version (4.3-14ubuntu1).
build-essential is already the newest version (12.1ubuntu2).
bzr is already the newest version (2.7.0-2ubuntu1).
curl is already the newest version (7.47.0-1ubuntu2).
debhelper is already the newest version (9.20160115ubuntu3).
distro-info is already the newest version (0.14build1).
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-5ubuntu12).
libjs-angularjs is already the newest version (1.2.28-1ubuntu2).
libjs-jquery is already the newest version (1.11.3+dfsg-4).
libjs-yui3-full is already the newest version (3.5.1-1ubuntu3).
libjs-yui3-min is already the newest version (3.5.1-1ubuntu3).
make is already the newest version (4.1-6).
postgresql is already the newest version (9.5+173).
pxelinux is already the newest version (3:6.03+dfsg-11ubunt...

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

The attempt to merge lp:~lamont/maas/bug-1589587 into lp:maas failed. Below is the output from the failed tests.

Hit:1 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease [94.5 kB]
Get:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Hit:4 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease
Fetched 189 kB in 0s (445 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
    --no-install-recommends install apache2 archdetect-deb authbind bash bind9 bind9utils build-essential bzr 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-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-netaddr python3-netifaces python3-novaclient 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-simplejson 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-2ubuntu3).
archdetect-deb is already the newest version (1.117ubuntu2).
authbind is already the newest version (2.1.1+nmu1).
bash is already the newest version (4.3-14ubuntu1).
build-essential is already the newest version (12.1ubuntu2).
bzr is already the newest version (2.7.0-2ubuntu1).
curl is already the newest version (7.47.0-1ubuntu2).
debhelper is already the newest version (9.20160115ubuntu3).
distro-info is already the newest version (0.14build1).
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-5ubuntu12).
libjs-angularjs is already the newest version (1.2.28-1ubuntu2).
libjs-jquery is already the newest version (1.11.3+dfsg-4).
libjs-yui3-full is already the newest version (3.5.1-1ubuntu3).
libjs-yui3-min is already the newest version (3.5.1-1ubuntu3).
make is already the newest version (4.1-6).
postgresql is already the newest version (9.5+173).
pxelinux is already the newest version (3:6.03+dfsg-11ubunt...

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

The attempt to merge lp:~lamont/maas/bug-1589587 into lp:maas failed. Below is the output from the failed tests.

Hit:1 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease [94.5 kB]
Hit:3 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:4 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease
Fetched 94.5 kB in 0s (193 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
    --no-install-recommends install apache2 archdetect-deb authbind bash bind9 bind9utils build-essential bzr 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-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-netaddr python3-netifaces python3-novaclient 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-simplejson 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-2ubuntu3).
archdetect-deb is already the newest version (1.117ubuntu2).
authbind is already the newest version (2.1.1+nmu1).
bash is already the newest version (4.3-14ubuntu1).
build-essential is already the newest version (12.1ubuntu2).
bzr is already the newest version (2.7.0-2ubuntu1).
curl is already the newest version (7.47.0-1ubuntu2).
debhelper is already the newest version (9.20160115ubuntu3).
distro-info is already the newest version (0.14build1).
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-5ubuntu12).
libjs-angularjs is already the newest version (1.2.28-1ubuntu2).
libjs-jquery is already the newest version (1.11.3+dfsg-4).
libjs-yui3-full is already the newest version (3.5.1-1ubuntu3).
libjs-yui3-min is already the newest version (3.5.1-1ubuntu3).
make is already the newest version (4.1-6).
postgresql is already the newest version (9.5+173).
pxelinux is already the newest version (3:6.03+dfsg-11ubuntu1).
pyth...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/models/fabric.py'
2--- src/maasserver/models/fabric.py 2016-04-27 20:18:20 +0000
3+++ src/maasserver/models/fabric.py 2016-06-13 14:21:41 +0000
4@@ -184,6 +184,8 @@
5 return self.id == 0
6
7 def get_default_vlan(self):
8+ # This logic is replicated in the dehydrate() function of the
9+ # websockets handler.
10 return self.vlan_set.all().order_by('id').first()
11
12 def get_name(self):
13
14=== modified file 'src/maasserver/static/js/angular/controllers/node_details_networking.js'
15--- src/maasserver/static/js/angular/controllers/node_details_networking.js 2016-05-23 08:05:13 +0000
16+++ src/maasserver/static/js/angular/controllers/node_details_networking.js 2016-06-13 14:21:41 +0000
17@@ -445,7 +445,7 @@
18
19 // Return the default VLAN for a fabric.
20 function getDefaultVLAN(fabric) {
21- return VLANsManager.getItemFromList(fabric.vlan_ids[0]);
22+ return VLANsManager.getItemFromList(fabric.default_vlan_id);
23 }
24
25 // Return list of unused VLANs for an interface. Also remove the
26
27=== modified file 'src/maasserver/static/js/angular/controllers/subnet_details.js'
28--- src/maasserver/static/js/angular/controllers/subnet_details.js 2016-05-12 19:07:37 +0000
29+++ src/maasserver/static/js/angular/controllers/subnet_details.js 2016-06-13 14:21:41 +0000
30@@ -87,7 +87,7 @@
31 // Fabric changed, the websocket expects VLAN to be updated, so
32 // we set the VLAN to the default VLAN for the new fabric.
33 subnet.vlan = FabricsManager.getItemFromList(
34- subnet.fabric).vlan_ids[0];
35+ subnet.fabric).default_vlan_id;
36 }
37 return subnet;
38 };
39
40=== modified file 'src/maasserver/static/js/angular/controllers/tests/test_fabric_details.js'
41--- src/maasserver/static/js/angular/controllers/tests/test_fabric_details.js 2016-06-09 19:38:53 +0000
42+++ src/maasserver/static/js/angular/controllers/tests/test_fabric_details.js 2016-06-13 14:21:41 +0000
43@@ -181,6 +181,7 @@
44 { id: 0, name:"subnet1", vlan: 1, space: 0, cidr: "10.20.0.0/16" }
45 ];
46 fabric.vlan_ids = [1];
47+ fabric.default_vlan_id = 1;
48 spaces[0].subnet_ids = [0];
49 SpacesManager._items.push(spaces[0]);
50 VLANsManager._items.push(vlans[0]);
51@@ -197,6 +198,7 @@
52 it("updates $scope.rows with VLANs containing no subnet(s)", function() {
53 var vlans = [ { id: 1, name: "vlan4", vid: 4, fabric: fabric.id } ];
54 fabric.vlan_ids = [1];
55+ fabric.default_vlan_id = 1;
56 VLANsManager._items.push(vlans[0]);
57 var controller = makeControllerResolveSetActiveItem();
58 $rootScope.$digest();
59
60=== modified file 'src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js'
61--- src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js 2016-05-23 08:05:13 +0000
62+++ src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js 2016-06-13 14:21:41 +0000
63@@ -1797,6 +1797,7 @@
64 var controller = makeController();
65 var fabric = {
66 id: 0,
67+ default_vlan_id: 0,
68 vlan_ids: [0]
69 };
70 var vlan = {
71@@ -1818,6 +1819,7 @@
72 var controller = makeController();
73 var fabric = {
74 id: 0,
75+ default_vlan_id: 0,
76 vlan_ids: [0]
77 };
78 var vlan = {
79@@ -3733,7 +3735,10 @@
80 it("sets mode to create-physical", function() {
81 var controller = makeController();
82 var vlan = { id: 0, fabric: 0 };
83- var fabric = { id: 0, name: makeName("fabric"), vlan_ids: [0] };
84+ var fabric = {
85+ id: 0, name: makeName("fabric"),
86+ default_vlan_id: 0, vlan_ids: [0]
87+ };
88 VLANsManager._items = [vlan];
89 $scope.fabrics = [fabric];
90 $scope.selectedMode = null;
91@@ -3744,7 +3749,10 @@
92 it("creates the newInterface", function() {
93 var controller = makeController();
94 var vlan = { id: 0, fabric: 0 };
95- var fabric = { id: 0, name: makeName("fabric"), vlan_ids: [0] };
96+ var fabric = {
97+ id: 0, name: makeName("fabric"),
98+ default_vlan_id: 0, vlan_ids: [0]
99+ };
100 VLANsManager._items = [vlan];
101 $scope.fabrics = [fabric];
102 $scope.selectedMode = null;
103@@ -3767,7 +3775,10 @@
104 it("sets newInterface.vlan with new fabric", function() {
105 var controller = makeController();
106 var vlan = { id: 0, fabric: 0 };
107- var fabric = { id: 0, name: makeName("fabric"), vlan_ids: [0] };
108+ var fabric = {
109+ id: 0, name: makeName("fabric"),
110+ default_vlan_id: 0, vlan_ids: [0]
111+ };
112 VLANsManager._items = [vlan];
113 $scope.newInterface.fabric = fabric;
114 $scope.newInterface.subnet = {};
115
116=== modified file 'src/maasserver/static/js/angular/controllers/tests/test_subnet_details.js'
117--- src/maasserver/static/js/angular/controllers/tests/test_subnet_details.js 2016-05-12 19:07:37 +0000
118+++ src/maasserver/static/js/angular/controllers/tests/test_subnet_details.js 2016-06-13 14:21:41 +0000
119@@ -256,6 +256,7 @@
120 };
121 var fabric = {
122 id: makeInteger(0, 100),
123+ default_vlan_id: vlan.id,
124 vlan_ids: [vlan.id]
125 };
126 FabricsManager._items.push(fabric);
127
128=== modified file 'src/maasserver/static/js/angular/controllers/tests/test_vlan_details.js'
129--- src/maasserver/static/js/angular/controllers/tests/test_vlan_details.js 2016-04-22 17:28:15 +0000
130+++ src/maasserver/static/js/angular/controllers/tests/test_vlan_details.js 2016-06-13 14:21:41 +0000
131@@ -80,6 +80,7 @@
132 system_id: sid,
133 hostname: name,
134 node_type: 2,
135+ default_vlan_id: VLAN_ID,
136 vlan_ids: [VLAN_ID]
137 };
138 ControllersManager._items.push(rack);
139
140=== modified file 'src/maasserver/static/js/angular/controllers/vlan_details.js'
141--- src/maasserver/static/js/angular/controllers/vlan_details.js 2016-05-12 19:07:37 +0000
142+++ src/maasserver/static/js/angular/controllers/vlan_details.js 2016-06-13 14:21:41 +0000
143@@ -420,7 +420,9 @@
144 vm.PROVIDE_DHCP_ACTION.title = "Provide DHCP";
145 }
146 vm.actionOptions.push(vm.PROVIDE_DHCP_ACTION);
147- vm.actionOptions.push(vm.DELETE_ACTION);
148+ if(!vm.isFabricDefault) {
149+ vm.actionOptions.push(vm.DELETE_ACTION);
150+ }
151 }
152 }
153
154@@ -428,6 +430,7 @@
155 function vlanLoaded(vlan) {
156 vm.vlan = vlan;
157 vm.fabric = FabricsManager.getItemFromList(vlan.fabric);
158+ vm.isFabricDefault = vm.fabric.default_vlan_id === vm.vlan.id;
159 vm.loaded = true;
160
161 updateTitle();
162
163=== modified file 'src/maasserver/websockets/handlers/fabric.py'
164--- src/maasserver/websockets/handlers/fabric.py 2016-05-11 19:01:48 +0000
165+++ src/maasserver/websockets/handlers/fabric.py 2016-06-13 14:21:41 +0000
166@@ -44,6 +44,9 @@
167 vlan.id
168 for vlan in obj.vlan_set.all()
169 ])
170+ # Pass the default vlan id explicitly, so that we don't reproduce the
171+ # logic in the javascript.
172+ data["default_vlan_id"] = data["vlan_ids"][0]
173 return data
174
175 def delete(self, parameters):
176
177=== modified file 'src/maasserver/websockets/handlers/tests/test_fabric.py'
178--- src/maasserver/websockets/handlers/tests/test_fabric.py 2016-04-28 13:34:34 +0000
179+++ src/maasserver/websockets/handlers/tests/test_fabric.py 2016-06-13 14:21:41 +0000
180@@ -27,6 +27,7 @@
181 for vlan in fabric.vlan_set.all()
182 ]),
183 }
184+ data["default_vlan_id"] = data["vlan_ids"][0]
185 return data
186
187 def test_get(self):