Merge lp:~blake-rouse/maas/hide-os-when-not-valid 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: 4369
Proposed branch: lp:~blake-rouse/maas/hide-os-when-not-valid
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 91 lines (+32/-6)
3 files modified
src/maasserver/static/partials/node-details.html (+6/-6)
src/maasserver/websockets/handlers/node.py (+13/-0)
src/maasserver/websockets/handlers/tests/test_node.py (+13/-0)
To merge this branch: bzr merge lp:~blake-rouse/maas/hide-os-when-not-valid
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) Approve
Review via email: mp+273950@code.launchpad.net

Commit message

Don't show the OS information in the machine summary unless it is in a state where it should be shown.

To post a comment you must log in.
Revision history for this message
Andres Rodriguez (andreserl) wrote :

lgtm!

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

The attempt to merge lp:~blake-rouse/maas/hide-os-when-not-valid 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://security.ubuntu.com trusty-security/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources
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/static/partials/node-details.html'
2--- src/maasserver/static/partials/node-details.html 2015-10-09 07:58:28 +0000
3+++ src/maasserver/static/partials/node-details.html 2015-10-09 21:10:27 +0000
4@@ -236,12 +236,12 @@
5 <dd class="four-col last-col">
6 {$ node.storage $}GB over {$ node.physical_disk_count $} disks
7 </dd>
8- <dt class="two-col">Operating System</dt>
9- <dd class="four-col last-col">{$ getOSText() $}</dd>
10- <dt class="two-col">Kernel</dt>
11- <dd class="four-col last-col">{$ node.hwe_kernel $}</dd>
12- <dt class="two-col ng-hide" data-ng-show="node.third_party_driver">Third Party Driver</dt>
13- <dd class="four-col last-col ng-hide" data-ng-show="node.third_party_driver">
14+ <dt class="two-col ng-hide" data-ng-show="node.show_os_info">Operating System</dt>
15+ <dd class="four-col last-col ng-hide" data-ng-show="node.show_os_info">{$ getOSText() $}</dd>
16+ <dt class="two-col ng-hide" data-ng-show="node.show_os_info">Kernel</dt>
17+ <dd class="four-col last-col ng-hide" data-ng-show="node.show_os_info">{$ node.hwe_kernel $}</dd>
18+ <dt class="two-col ng-hide" data-ng-show="node.show_os_info && node.third_party_driver">Third Party Driver</dt>
19+ <dd class="four-col last-col ng-hide" data-ng-show="node.show_os_info && node.third_party_driver">
20 {$ node.third_party_driver.module $} "{$ node.third_party_driver.comment $}"
21 </dd>
22 </dl>
23
24=== modified file 'src/maasserver/websockets/handlers/node.py'
25--- src/maasserver/websockets/handlers/node.py 2015-10-06 05:58:47 +0000
26+++ src/maasserver/websockets/handlers/node.py 2015-10-09 21:10:27 +0000
27@@ -27,6 +27,7 @@
28 INTERFACE_LINK_TYPE,
29 IPADDRESS_TYPE,
30 NODE_PERMISSION,
31+ NODE_STATUS,
32 )
33 from maasserver.exceptions import NodeActionError
34 from maasserver.forms import (
35@@ -242,6 +243,7 @@
36 for tag in obj.tags.all()
37 ]
38 if not for_list:
39+ data["show_os_info"] = self.dehydrate_show_os_info(obj)
40 data["osystem"] = obj.get_osystem()
41 data["distro_series"] = obj.get_distro_series()
42 data["hwe_kernel"] = obj.hwe_kernel
43@@ -291,6 +293,17 @@
44
45 return data
46
47+ def dehydrate_show_os_info(self, obj):
48+ """Return True if OS information should show in the UI."""
49+ return (
50+ obj.status == NODE_STATUS.DEPLOYING or
51+ obj.status == NODE_STATUS.FAILED_DEPLOYMENT or
52+ obj.status == NODE_STATUS.DEPLOYED or
53+ obj.status == NODE_STATUS.RELEASING or
54+ obj.status == NODE_STATUS.FAILED_RELEASING or
55+ obj.status == NODE_STATUS.DISK_ERASING or
56+ obj.status == NODE_STATUS.FAILED_DISK_ERASING)
57+
58 def dehydrate_device(self, device):
59 """Return the `Device` formatted for JSON encoding."""
60 return {
61
62=== modified file 'src/maasserver/websockets/handlers/tests/test_node.py'
63--- src/maasserver/websockets/handlers/tests/test_node.py 2015-10-06 05:58:47 +0000
64+++ src/maasserver/websockets/handlers/tests/test_node.py 2015-10-09 21:10:27 +0000
65@@ -176,6 +176,7 @@
66 "%s" % boot_interface.mac_address),
67 "pxe_mac_vendor": "" if pxe_mac_vendor is None else pxe_mac_vendor,
68 "routers": handler.dehydrate_routers(node.routers),
69+ "show_os_info": handler.dehydrate_show_os_info(node),
70 "status": node.display_status(),
71 "storage": "%3.1f" % (sum([
72 blockdevice.size
73@@ -294,6 +295,18 @@
74 }
75 self.assertEquals(params, handler.dehydrate_power_parameters(params))
76
77+ def test_dehydrate_show_os_info_returns_true(self):
78+ owner = factory.make_User()
79+ node = factory.make_Node(owner=owner, status=NODE_STATUS.DEPLOYED)
80+ handler = NodeHandler(owner, {})
81+ self.assertTrue(handler.dehydrate_show_os_info(node))
82+
83+ def test_dehydrate_show_os_info_returns_false(self):
84+ owner = factory.make_User()
85+ node = factory.make_Node(owner=owner, status=NODE_STATUS.READY)
86+ handler = NodeHandler(owner, {})
87+ self.assertFalse(handler.dehydrate_show_os_info(node))
88+
89 def test_dehydrate_device(self):
90 owner = factory.make_User()
91 node = factory.make_Node(owner=owner)