Merge lp:~mwhudson/lava-dispatcher/bug-900990 into lp:lava-dispatcher

Proposed by Michael Hudson-Doyle
Status: Merged
Merged at revision: 173
Proposed branch: lp:~mwhudson/lava-dispatcher/bug-900990
Merge into: lp:lava-dispatcher
Diff against target: 75 lines (+20/-18)
1 file modified
lava_dispatcher/client/master.py (+20/-18)
To merge this branch: bzr merge lp:~mwhudson/lava-dispatcher/bug-900990
Reviewer Review Type Date Requested Status
Paul Larson (community) Approve
Review via email: mp+84701@code.launchpad.net

Description of the change

This branch moves the wget | tar type of deployment into a helper function, and makes sure that we fail if this command fails (which was not previously the case for android deployments).

To post a comment you must log in.
Revision history for this message
Paul Larson (pwlars) wrote :

8 +def _deploy_tarball_to_board(session, tarball_url, dest, timeout=-1):
9 + decompression_char = ''
10 + if tarball_url.endswith('.gz') or tarball_url.endswith('.tgz'):
11 + decompression_char = 'z'
12 + elif tarball_url.endswith('.bz2'):
13 + decompression_char = 'j'
14 + rc = session.run(
15 + 'wget -qO- %s |tar --numeric-owner -C %s -x%sf -' % (
16 + tarball_url, dest, decompression_char),
17 + timeout=3600)
I would imagine you intended to use the specified timeout passed in.

Otherwise, +1

review: Approve
178. By Michael Hudson-Doyle

thanks paul

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava_dispatcher/client/master.py'
2--- lava_dispatcher/client/master.py 2011-11-29 03:28:23 +0000
3+++ lava_dispatcher/client/master.py 2011-12-07 01:09:23 +0000
4@@ -63,17 +63,27 @@
5 raise RuntimeError("Failed to create tarball: %s" % tarfile)
6
7
8+def _deploy_tarball_to_board(session, tarball_url, dest, timeout=-1):
9+ decompression_char = ''
10+ if tarball_url.endswith('.gz') or tarball_url.endswith('.tgz'):
11+ decompression_char = 'z'
12+ elif tarball_url.endswith('.bz2'):
13+ decompression_char = 'j'
14+ rc = session.run(
15+ 'wget -qO- %s |tar --numeric-owner -C %s -x%sf -' % (
16+ tarball_url, dest, decompression_char),
17+ timeout=3600)
18+ if rc != 0:
19+ msg = "Deploy: failed to deploy to %s" % dest
20+ raise OperationFailed(msg)
21+
22+
23 def _deploy_linaro_rootfs(session, rootfs):
24 logging.info("Deploying linaro image")
25 session.run('udevadm trigger')
26 session.run('mkdir -p /mnt/root')
27 session.run('mount /dev/disk/by-label/testrootfs /mnt/root')
28- rc = session.run(
29- 'wget -qO- %s |tar --numeric-owner -C /mnt/root -xzf -' % rootfs,
30- timeout=3600)
31- if rc != 0:
32- msg = "Deploy test rootfs partition: failed to download tarball."
33- raise OperationFailed(msg)
34+ _deploy_tarball_to_board(session, rootfs, '/mnt/root', timeout=3600)
35
36 session.run('echo linaro > /mnt/root/etc/hostname')
37 #DO NOT REMOVE - diverting flash-kernel and linking it to /bin/true
38@@ -90,11 +100,7 @@
39 session.run('udevadm trigger')
40 session.run('mkdir -p /mnt/boot')
41 session.run('mount /dev/disk/by-label/testboot /mnt/boot')
42- rc = session.run(
43- 'wget -qO- %s |tar --numeric-owner -C /mnt/boot -xzf -' % bootfs)
44- if rc != 0:
45- msg = "Deploy test boot partition: failed to download tarball."
46- raise OperationFailed(msg)
47+ _deploy_tarball_to_board(session, bootfs, '/mnt/boot')
48 session.run('umount /mnt/boot')
49
50 def _deploy_linaro_android_testboot(session, boottbz2, pkgbz2=None):
51@@ -106,11 +112,9 @@
52 session.run('mkdir -p /mnt/lava/boot')
53 session.run('mount /dev/disk/by-label/testboot '
54 '/mnt/lava/boot')
55- session.run('wget -qO- %s |tar --numeric-owner -C /mnt/lava -xjf -' % boottbz2)
56+ _deploy_tarball_to_board(session, boottbz2, '/mnt/lava')
57 if pkgbz2:
58- session.run(
59- 'wget -qO- %s |tar --numeric-owner -C /mnt/lava -xjf -'
60- % pkgbz2)
61+ _deploy_tarball_to_board(session, pkgbz2, '/mnt/lava')
62
63 _recreate_uInitrd(session)
64
65@@ -167,9 +171,7 @@
66 session.run('mkdir -p /mnt/lava/system')
67 session.run(
68 'mount /dev/disk/by-label/testrootfs /mnt/lava/system')
69- session.run(
70- 'wget -qO- %s |tar --numeric-owner -C /mnt/lava -xjf -' % systemtbz2,
71- timeout=600)
72+ _deploy_tarball_to_board(session, systemtbz2, '/mnt/lava', timeout=600)
73
74 sed_cmd = "/dev_mount sdcard \/mnt\/sdcard/c dev_mount sdcard /mnt/sdcard %s " \
75 "/devices/platform/omap/omap_hsmmc.0/mmc_host/mmc0" %sdcard_part_lava

Subscribers

People subscribed via source and target branches