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
=== modified file 'src/maasserver/static/partials/node-details.html'
--- src/maasserver/static/partials/node-details.html 2015-10-09 07:58:28 +0000
+++ src/maasserver/static/partials/node-details.html 2015-10-09 21:10:27 +0000
@@ -236,12 +236,12 @@
236 <dd class="four-col last-col">236 <dd class="four-col last-col">
237 {$ node.storage $}GB over {$ node.physical_disk_count $} disks237 {$ node.storage $}GB over {$ node.physical_disk_count $} disks
238 </dd>238 </dd>
239 <dt class="two-col">Operating System</dt>239 <dt class="two-col ng-hide" data-ng-show="node.show_os_info">Operating System</dt>
240 <dd class="four-col last-col">{$ getOSText() $}</dd>240 <dd class="four-col last-col ng-hide" data-ng-show="node.show_os_info">{$ getOSText() $}</dd>
241 <dt class="two-col">Kernel</dt>241 <dt class="two-col ng-hide" data-ng-show="node.show_os_info">Kernel</dt>
242 <dd class="four-col last-col">{$ node.hwe_kernel $}</dd>242 <dd class="four-col last-col ng-hide" data-ng-show="node.show_os_info">{$ node.hwe_kernel $}</dd>
243 <dt class="two-col ng-hide" data-ng-show="node.third_party_driver">Third Party Driver</dt>243 <dt class="two-col ng-hide" data-ng-show="node.show_os_info && node.third_party_driver">Third Party Driver</dt>
244 <dd class="four-col last-col ng-hide" data-ng-show="node.third_party_driver">244 <dd class="four-col last-col ng-hide" data-ng-show="node.show_os_info && node.third_party_driver">
245 {$ node.third_party_driver.module $} "{$ node.third_party_driver.comment $}"245 {$ node.third_party_driver.module $} "{$ node.third_party_driver.comment $}"
246 </dd>246 </dd>
247 </dl>247 </dl>
248248
=== modified file 'src/maasserver/websockets/handlers/node.py'
--- src/maasserver/websockets/handlers/node.py 2015-10-06 05:58:47 +0000
+++ src/maasserver/websockets/handlers/node.py 2015-10-09 21:10:27 +0000
@@ -27,6 +27,7 @@
27 INTERFACE_LINK_TYPE,27 INTERFACE_LINK_TYPE,
28 IPADDRESS_TYPE,28 IPADDRESS_TYPE,
29 NODE_PERMISSION,29 NODE_PERMISSION,
30 NODE_STATUS,
30)31)
31from maasserver.exceptions import NodeActionError32from maasserver.exceptions import NodeActionError
32from maasserver.forms import (33from maasserver.forms import (
@@ -242,6 +243,7 @@
242 for tag in obj.tags.all()243 for tag in obj.tags.all()
243 ]244 ]
244 if not for_list:245 if not for_list:
246 data["show_os_info"] = self.dehydrate_show_os_info(obj)
245 data["osystem"] = obj.get_osystem()247 data["osystem"] = obj.get_osystem()
246 data["distro_series"] = obj.get_distro_series()248 data["distro_series"] = obj.get_distro_series()
247 data["hwe_kernel"] = obj.hwe_kernel249 data["hwe_kernel"] = obj.hwe_kernel
@@ -291,6 +293,17 @@
291293
292 return data294 return data
293295
296 def dehydrate_show_os_info(self, obj):
297 """Return True if OS information should show in the UI."""
298 return (
299 obj.status == NODE_STATUS.DEPLOYING or
300 obj.status == NODE_STATUS.FAILED_DEPLOYMENT or
301 obj.status == NODE_STATUS.DEPLOYED or
302 obj.status == NODE_STATUS.RELEASING or
303 obj.status == NODE_STATUS.FAILED_RELEASING or
304 obj.status == NODE_STATUS.DISK_ERASING or
305 obj.status == NODE_STATUS.FAILED_DISK_ERASING)
306
294 def dehydrate_device(self, device):307 def dehydrate_device(self, device):
295 """Return the `Device` formatted for JSON encoding."""308 """Return the `Device` formatted for JSON encoding."""
296 return {309 return {
297310
=== modified file 'src/maasserver/websockets/handlers/tests/test_node.py'
--- src/maasserver/websockets/handlers/tests/test_node.py 2015-10-06 05:58:47 +0000
+++ src/maasserver/websockets/handlers/tests/test_node.py 2015-10-09 21:10:27 +0000
@@ -176,6 +176,7 @@
176 "%s" % boot_interface.mac_address),176 "%s" % boot_interface.mac_address),
177 "pxe_mac_vendor": "" if pxe_mac_vendor is None else pxe_mac_vendor,177 "pxe_mac_vendor": "" if pxe_mac_vendor is None else pxe_mac_vendor,
178 "routers": handler.dehydrate_routers(node.routers),178 "routers": handler.dehydrate_routers(node.routers),
179 "show_os_info": handler.dehydrate_show_os_info(node),
179 "status": node.display_status(),180 "status": node.display_status(),
180 "storage": "%3.1f" % (sum([181 "storage": "%3.1f" % (sum([
181 blockdevice.size182 blockdevice.size
@@ -294,6 +295,18 @@
294 }295 }
295 self.assertEquals(params, handler.dehydrate_power_parameters(params))296 self.assertEquals(params, handler.dehydrate_power_parameters(params))
296297
298 def test_dehydrate_show_os_info_returns_true(self):
299 owner = factory.make_User()
300 node = factory.make_Node(owner=owner, status=NODE_STATUS.DEPLOYED)
301 handler = NodeHandler(owner, {})
302 self.assertTrue(handler.dehydrate_show_os_info(node))
303
304 def test_dehydrate_show_os_info_returns_false(self):
305 owner = factory.make_User()
306 node = factory.make_Node(owner=owner, status=NODE_STATUS.READY)
307 handler = NodeHandler(owner, {})
308 self.assertFalse(handler.dehydrate_show_os_info(node))
309
297 def test_dehydrate_device(self):310 def test_dehydrate_device(self):
298 owner = factory.make_User()311 owner = factory.make_User()
299 node = factory.make_Node(owner=owner)312 node = factory.make_Node(owner=owner)