Merge ~bladernr/plainbox-provider-checkbox:improve-maas-version-check into plainbox-provider-checkbox:master

Proposed by Jeff Lane 
Status: Merged
Approved by: Jeff Lane 
Approved revision: e81971b4aafb890216a63dedee548520716f5537
Merged at revision: a56233d6b94e10a5f33d7577d39573d3bff10f38
Proposed branch: ~bladernr/plainbox-provider-checkbox:improve-maas-version-check
Merge into: plainbox-provider-checkbox:master
Diff against target: 61 lines (+35/-8)
2 files modified
bin/maas-version-check (+33/-0)
jobs/miscellanea.txt.in (+2/-8)
Reviewer Review Type Date Requested Status
Maciej Kisielewski Approve
Review via email: mp+313644@code.launchpad.net

Description of the change

Improve the MAAS version check. Now it will fail if the MAAS version is < 2.0, as well as still fail if the file is not present.

To post a comment you must log in.
Revision history for this message
Maciej Kisielewski (kissiel) wrote :

The helper looks good.
I've looked for old jobs that this (stronger version requirement) could break - none found.
Overall +1. Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/maas-version-check b/bin/maas-version-check
2new file mode 100755
3index 0000000..412717d
4--- /dev/null
5+++ b/bin/maas-version-check
6@@ -0,0 +1,33 @@
7+#!/bin/bash
8+
9+# Copyright (C) 2012-2015 Canonical Ltd.
10+
11+# Authors
12+# Jeff Lane <jeff@ubuntu.com>
13+
14+# This program is free software: you can redistribute it and/or modify
15+# it under the terms of the GNU General Public License version 3,
16+# as published by the Free Software Foundation.
17+
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU General Public License for more details.
22+
23+# You should have received a copy of the GNU General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+
26+MAAS_FILE="/etc/installed-by-maas"
27+MIN_VERSION="2.0"
28+
29+# Is the file there?
30+if [ -s $MAAS_FILE ]; then
31+ maas_version=`cat $MAAS_FILE`
32+ echo $maas_version
33+else
34+ echo "ERROR: This system does not appear to have been installed by MAAS"
35+ exit 1
36+fi
37+
38+#is the version appropriate
39+exit `dpkg --compare-versions $maas_version "ge" $MIN_VERSION`
40diff --git a/jobs/miscellanea.txt.in b/jobs/miscellanea.txt.in
41index e018be5..80ccf02 100644
42--- a/jobs/miscellanea.txt.in
43+++ b/jobs/miscellanea.txt.in
44@@ -289,15 +289,9 @@ plugin: shell
45 category_id: 2013.com.canonical.plainbox::miscellanea
46 estimated_duration: 0.1
47 id: miscellanea/get_maas_version
48-command:
49- if [ -s /etc/installed-by-maas ]; then
50- cat /etc/installed-by-maas
51- else
52- echo "MAAS VERSION NOT FOUND" >&2
53- false
54- fi
55+command: maas-version-check
56 _description: If system was installed via MAAS from a cert server, the MAAS version used should be contained in /etc/installed-by-maas
57-_summary: Attach MAAS version used to deploy the SUT
58+_summary: Verify MAAS version used to deploy the SUT
59
60 plugin: shell
61 category_id: 2013.com.canonical.plainbox::miscellanea

Subscribers

People subscribed via source and target branches