yellow team mailing list archive
-
yellow team
-
Mailing list archive
-
Message #00570
[Merge] lp:~frankban/launchpad/setuplxc-remove-sleep into lp:~frankban/launchpad/more-integration
Francesco Banconi has proposed merging lp:~frankban/launchpad/setuplxc-remove-sleep into lp:~frankban/launchpad/more-integration.
Requested reviews:
Launchpad Yellow Squad (yellow)
For more details, see:
https://code.launchpad.net/~frankban/launchpad/setuplxc-remove-sleep/+merge/96422
== Changes ==
- Replaced *sleep 30* with an ssh/sleep loop.
- Removed unused function argument in *create_scripts*.
== Notes ==
The diff is against the merge of latest Benji's branch and devel.
--
https://code.launchpad.net/~frankban/launchpad/setuplxc-remove-sleep/+merge/96422
Your team Launchpad Yellow Squad is requested to review the proposed merge of lp:~frankban/launchpad/setuplxc-remove-sleep into lp:~frankban/launchpad/more-integration.
=== modified file 'utilities/setuplxc.py'
--- utilities/setuplxc.py 2012-03-06 00:11:17 +0000
+++ utilities/setuplxc.py 2012-03-07 18:13:24 +0000
@@ -754,6 +754,7 @@
path = os.path.join(dependencies_dir, subdir)
if not os.path.exists(path):
os.makedirs(path)
+<<<<<<< TREE
with cd(dependencies_dir):
with su(user) as env:
subprocess.call([
@@ -769,12 +770,29 @@
'ssh_key_path': ssh_key_path,
'checkout_dir': os.path.join(directory, LP_CHECKOUT),
}
+=======
+ with cd(dependencies_dir):
+ with su(user) as env:
+ subprocess.call([
+ 'bzr', 'co', '--lightweight',
+ LP_SOURCE_DEPS, 'download-cache'])
+
+
+def create_scripts(user, lxcname, ssh_key_path):
+ """Create scripts to update the Launchpad environment and run tests."""
+ mapping = {
+ 'lxcname': lxcname,
+ 'ssh_key_path': ssh_key_path,
+ 'user': user,
+ }
+>>>>>>> MERGE-SOURCE
# We need a script that will run the LP build inside LXC. It is run as
# root (see below) but drops root once inside the LXC container.
build_script_file = '/usr/local/bin/launchpad-lxc-build'
with open(build_script_file, 'w') as script:
script.write(textwrap.dedent("""\
#!/bin/sh
+<<<<<<< TREE
set -uex
lxc-start -n {lxcname} -d
lxc-wait -n {lxcname} -s RUNNING
@@ -784,6 +802,27 @@
lxc-stop -n {lxcname}
lxc-wait -n {lxcname} -s STOPPED
""".format(**mapping)))
+=======
+ set -ux
+ lxc-start -n {lxcname} -d
+ lxc-wait -n {lxcname} -s RUNNING
+ for i in $(seq 1 30); do
+ su {user} -c "/usr/bin/ssh -o StrictHostKeyChecking=no \\
+ -i '{ssh_key_path}' {lxcname} make -C $PWD schema"
+ if [ ! 255 -eq $? ]; then
+ # If ssh returns 255 then its connection failed.
+ # Anything else is either success (status 0) or a
+ # failure from whatever we ran over the SSH connection.
+ # In those cases we want to stop looping, so we break
+ # here.
+ break;
+ fi
+ sleep 1
+ done
+ lxc-stop -n {lxcname}
+ lxc-wait -n {lxcname} -s STOPPED
+ """.format(**mapping)))
+>>>>>>> MERGE-SOURCE
os.chmod(build_script_file, 0555)
# We need a script to test launchpad using LXC ephemeral instances.
test_script_file = '/usr/local/bin/launchpad-lxc-test'
@@ -955,7 +994,11 @@
('initialize_host', (
user, fullname, email, lpuser, private_key, public_key,
ssh_key_path, dependencies_dir, directory)),
+<<<<<<< TREE
('create_scripts', (user, directory, lxc_name, ssh_key_path)),
+=======
+ ('create_scripts', (user, lxc_name, ssh_key_path)),
+>>>>>>> MERGE-SOURCE
('create_lxc', (user, lxc_name, ssh_key_path)),
('initialize_lxc', (
user, dependencies_dir, directory, lxc_name, ssh_key_path)),