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
=== modified file 'lava_dispatcher/client/master.py'
--- lava_dispatcher/client/master.py 2011-11-29 03:28:23 +0000
+++ lava_dispatcher/client/master.py 2011-12-07 01:09:23 +0000
@@ -63,17 +63,27 @@
63 raise RuntimeError("Failed to create tarball: %s" % tarfile)63 raise RuntimeError("Failed to create tarball: %s" % tarfile)
6464
6565
66def _deploy_tarball_to_board(session, tarball_url, dest, timeout=-1):
67 decompression_char = ''
68 if tarball_url.endswith('.gz') or tarball_url.endswith('.tgz'):
69 decompression_char = 'z'
70 elif tarball_url.endswith('.bz2'):
71 decompression_char = 'j'
72 rc = session.run(
73 'wget -qO- %s |tar --numeric-owner -C %s -x%sf -' % (
74 tarball_url, dest, decompression_char),
75 timeout=3600)
76 if rc != 0:
77 msg = "Deploy: failed to deploy to %s" % dest
78 raise OperationFailed(msg)
79
80
66def _deploy_linaro_rootfs(session, rootfs):81def _deploy_linaro_rootfs(session, rootfs):
67 logging.info("Deploying linaro image")82 logging.info("Deploying linaro image")
68 session.run('udevadm trigger')83 session.run('udevadm trigger')
69 session.run('mkdir -p /mnt/root')84 session.run('mkdir -p /mnt/root')
70 session.run('mount /dev/disk/by-label/testrootfs /mnt/root')85 session.run('mount /dev/disk/by-label/testrootfs /mnt/root')
71 rc = session.run(86 _deploy_tarball_to_board(session, rootfs, '/mnt/root', timeout=3600)
72 'wget -qO- %s |tar --numeric-owner -C /mnt/root -xzf -' % rootfs,
73 timeout=3600)
74 if rc != 0:
75 msg = "Deploy test rootfs partition: failed to download tarball."
76 raise OperationFailed(msg)
7787
78 session.run('echo linaro > /mnt/root/etc/hostname')88 session.run('echo linaro > /mnt/root/etc/hostname')
79 #DO NOT REMOVE - diverting flash-kernel and linking it to /bin/true89 #DO NOT REMOVE - diverting flash-kernel and linking it to /bin/true
@@ -90,11 +100,7 @@
90 session.run('udevadm trigger')100 session.run('udevadm trigger')
91 session.run('mkdir -p /mnt/boot')101 session.run('mkdir -p /mnt/boot')
92 session.run('mount /dev/disk/by-label/testboot /mnt/boot')102 session.run('mount /dev/disk/by-label/testboot /mnt/boot')
93 rc = session.run(103 _deploy_tarball_to_board(session, bootfs, '/mnt/boot')
94 'wget -qO- %s |tar --numeric-owner -C /mnt/boot -xzf -' % bootfs)
95 if rc != 0:
96 msg = "Deploy test boot partition: failed to download tarball."
97 raise OperationFailed(msg)
98 session.run('umount /mnt/boot')104 session.run('umount /mnt/boot')
99105
100def _deploy_linaro_android_testboot(session, boottbz2, pkgbz2=None):106def _deploy_linaro_android_testboot(session, boottbz2, pkgbz2=None):
@@ -106,11 +112,9 @@
106 session.run('mkdir -p /mnt/lava/boot')112 session.run('mkdir -p /mnt/lava/boot')
107 session.run('mount /dev/disk/by-label/testboot '113 session.run('mount /dev/disk/by-label/testboot '
108 '/mnt/lava/boot')114 '/mnt/lava/boot')
109 session.run('wget -qO- %s |tar --numeric-owner -C /mnt/lava -xjf -' % boottbz2)115 _deploy_tarball_to_board(session, boottbz2, '/mnt/lava')
110 if pkgbz2:116 if pkgbz2:
111 session.run(117 _deploy_tarball_to_board(session, pkgbz2, '/mnt/lava')
112 'wget -qO- %s |tar --numeric-owner -C /mnt/lava -xjf -'
113 % pkgbz2)
114118
115 _recreate_uInitrd(session)119 _recreate_uInitrd(session)
116120
@@ -167,9 +171,7 @@
167 session.run('mkdir -p /mnt/lava/system')171 session.run('mkdir -p /mnt/lava/system')
168 session.run(172 session.run(
169 'mount /dev/disk/by-label/testrootfs /mnt/lava/system')173 'mount /dev/disk/by-label/testrootfs /mnt/lava/system')
170 session.run(174 _deploy_tarball_to_board(session, systemtbz2, '/mnt/lava', timeout=600)
171 'wget -qO- %s |tar --numeric-owner -C /mnt/lava -xjf -' % systemtbz2,
172 timeout=600)
173175
174 sed_cmd = "/dev_mount sdcard \/mnt\/sdcard/c dev_mount sdcard /mnt/sdcard %s " \176 sed_cmd = "/dev_mount sdcard \/mnt\/sdcard/c dev_mount sdcard /mnt/sdcard %s " \
175 "/devices/platform/omap/omap_hsmmc.0/mmc_host/mmc0" %sdcard_part_lava177 "/devices/platform/omap/omap_hsmmc.0/mmc_host/mmc0" %sdcard_part_lava

Subscribers

People subscribed via source and target branches