Merge lp:~lamont/maas/bug-1567249-1.9 into lp:maas/1.9

Proposed by LaMont Jones on 2016-07-08
Status: Merged
Approved by: LaMont Jones on 2016-07-11
Approved revision: 4594
Merged at revision: 4590
Proposed branch: lp:~lamont/maas/bug-1567249-1.9
Merge into: lp:maas/1.9
Diff against target: 79 lines (+35/-1)
3 files modified
docs/changelog.rst (+2/-0)
src/maasserver/clusterrpc/power_parameters.py (+15/-1)
src/maasserver/clusterrpc/tests/test_power_parameters.py (+18/-0)
To merge this branch: bzr merge lp:~lamont/maas/bug-1567249-1.9
Reviewer Review Type Date Requested Status
Blake Rouse (community) 2016-07-08 Approve on 2016-07-11
Review via email: mp+299608@code.launchpad.net

Commit message

Complain intelligently if the rack controller is running an old version (1.7) of maas (missing_packages was introduced in revno 4343)

Description of the change

Complain intelligently if the rack controller is running an old version (1.7) of maas (missing_packages was introduced in revno 4343)

A 1.7 cluster controller would successfully connect to a 1.9 region controller, and the first that anyone would have any issues was when they went to look at a node (not cluster/rack controller..) and got a KeyError traceback. Detecting this error and giving the admin a hint of why they're seeing this strange thing keeps then from diving down the rabbit hole.

With a 2.0 region controller, the 1.7 (and 1.9) cluster/rack controllers fail to connect at all, so it becomes clear that "there's an issue with cluster controller $FOO" rather quickly, and the obvious investigative actions lead to the right problem being found.

To post a comment you must log in.
Blake Rouse (blake-rouse) wrote :

Looks good, but no test?

The description also makes since and why this is not needed in 2.0+.

review: Needs Fixing
Blake Rouse (blake-rouse) wrote :

Looks good.

review: Approve
MAAS Lander (maas-lander) wrote :
Download full text (270.9 KiB)

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

Hit http://security.ubuntu.com trusty-security InRelease
Ign http://prodstack-zone-1.clouds.archive.ubuntu.com trusty InRelease
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports InRelease
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty Release.gpg
Hit http://prodstack-zone-1.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://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates/main Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates/restricted Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates/universe Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates/multiverse Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates/restricted amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-updates/multiverse amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports/main Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports/restricted Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports/universe Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports/multiverse Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports/main amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports/restricted amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports/universe amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty-backports/multiverse amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty/main Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty/restricted Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty/multiverse Sources
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty/restricted amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://prodstack-zone-1.clouds.archive.ubuntu.com trusty/multiverse amd64 Packages
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 fire...

lp:~lamont/maas/bug-1567249-1.9 updated on 2016-07-11
4594. By LaMont Jones on 2016-07-11

Add changelog entry.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'docs/changelog.rst'
2--- docs/changelog.rst 2016-06-30 17:36:38 +0000
3+++ docs/changelog.rst 2016-07-11 16:38:15 +0000
4@@ -19,6 +19,8 @@
5
6 LP: #1597460 [1.9] MAAS 1.9 should only download filetypes from a SimpleStream is can process
7
8+LP: #1567249 [1.9] If rack and region have different versions, the error is uninformative and confusing.
9+
10 1.9.3
11 =====
12
13
14=== modified file 'src/maasserver/clusterrpc/power_parameters.py'
15--- src/maasserver/clusterrpc/power_parameters.py 2015-10-19 04:54:14 +0000
16+++ src/maasserver/clusterrpc/power_parameters.py 2016-07-11 16:38:15 +0000
17@@ -40,6 +40,7 @@
18 from jsonschema import validate
19 from maasserver.clusterrpc.utils import call_clusters
20 from maasserver.config_forms import DictCharField
21+from maasserver.exceptions import ClusterUnavailable
22 from maasserver.fields import MACAddressFormField
23 from maasserver.utils.forms import compose_invalid_choice_text
24 from provisioningserver.power.schema import (
25@@ -199,7 +200,20 @@
26 name = power_type['name']
27 fields = power_type['fields']
28 description = power_type['description']
29- missing_packages = power_type['missing_packages']
30+ try:
31+ missing_packages = power_type['missing_packages']
32+ except KeyError:
33+ msg = (
34+ """Bad response from cluster controller. This likely """
35+ """means that it is running an earlier version of MAAS.""")
36+ if nodegroups is not None:
37+ if len(nodegroups) == 1:
38+ msg += " Controller: "
39+ else:
40+ msg += " Controllers: "
41+ msg += ", ".join([ctl.name for ctl in nodegroups])
42+ msg += "."
43+ raise ClusterUnavailable(msg)
44 add_power_type_parameters(
45 name, description, fields, missing_packages, merged_types)
46 return sorted(merged_types, key=itemgetter("description"))
47
48=== modified file 'src/maasserver/clusterrpc/tests/test_power_parameters.py'
49--- src/maasserver/clusterrpc/tests/test_power_parameters.py 2015-10-01 22:48:50 +0000
50+++ src/maasserver/clusterrpc/tests/test_power_parameters.py 2016-07-11 16:38:15 +0000
51@@ -27,6 +27,7 @@
52 POWER_TYPE_PARAMETER_FIELD_SCHEMA,
53 )
54 from maasserver.config_forms import DictCharField
55+from maasserver.exceptions import ClusterUnavailable
56 from maasserver.fields import MACAddressFormField
57 from maasserver.testing.factory import factory
58 from maasserver.testing.testcase import MAASServerTestCase
59@@ -322,3 +323,20 @@
60 self.assertThat(
61 mocked, MockCalledOnceWith(
62 sentinel.nodegroup, sentinel.ignore_errors))
63+
64+ def test_get_power_types_detects_missing_missing_packages_key(self):
65+ mocked = self.patch(power_parameters, "call_clusters")
66+ mocked.return_value = [{
67+ 'power_types': [
68+ {'name': "virsh", 'fields': "foo", 'description': "desc"},
69+ {'name': "other", 'fields': "bar", 'description': "meh"},
70+ ],
71+ }]
72+ e = self.assertRaises(
73+ ClusterUnavailable,
74+ power_parameters.get_all_power_types_from_clusters
75+ )
76+ self.assertEqual(
77+ """Bad response from cluster controller. This likely """
78+ """means that it is running an earlier version of MAAS.""",
79+ e.message)

Subscribers

People subscribed via source and target branches