yellow team mailing list archive
-
yellow team
-
Mailing list archive
-
Message #00493
[Merge] lp:~frankban/launchpad/setuplxc-add-apt-repository into lp:launchpad
Francesco Banconi has proposed merging lp:~frankban/launchpad/setuplxc-add-apt-repository into lp:launchpad with lp:~benji/launchpad/add-sudoers-to-lxcsetup as a prerequisite.
Requested reviews:
Launchpad Yellow Squad (yellow)
For more details, see:
https://code.launchpad.net/~frankban/launchpad/setuplxc-add-apt-repository/+merge/94761
== Changes ==
- add-apt-repository is now used to set up APT repositories to be used by
the container.
- Apt --allow-unauthenticated no longer needed.
- Backported a fix to `get_args_from_namespace`: actions are now correctly
parsed.
--
https://code.launchpad.net/~frankban/launchpad/setuplxc-add-apt-repository/+merge/94761
Your team Launchpad Yellow Squad is requested to review the proposed merge of lp:~frankban/launchpad/setuplxc-add-apt-repository into lp:launchpad.
=== modified file 'utilities/setuplxc.py'
--- utilities/setuplxc.py 2012-02-27 13:13:49 +0000
+++ utilities/setuplxc.py 2012-02-27 13:13:50 +0000
@@ -39,7 +39,13 @@
import sys
import time
-
+APT_REPOSITORIES = (
+ 'deb http://archive.ubuntu.com/ubuntu {distro} multiverse',
+ 'deb http://archive.ubuntu.com/ubuntu {distro}-updates multiverse',
+ 'deb http://archive.ubuntu.com/ubuntu {distro}-security multiverse',
+ 'ppa:launchpad/ppa',
+ 'ppa:bzr/ppa',
+ )
DEPENDENCIES_DIR = '~/dependencies'
DHCP_FILE = '/etc/dhcp/dhclient.conf'
HOST_PACKAGES = ['ssh', 'lxc', 'libvirt-bin', 'bzr', 'language-pack-en']
@@ -81,16 +87,6 @@
lxc.network.flags = up
"""
LXC_PATH = '/var/lib/lxc/'
-LXC_REPOS = (
- 'deb http://archive.ubuntu.com/ubuntu '
- 'lucid main universe multiverse',
- 'deb http://archive.ubuntu.com/ubuntu '
- 'lucid-updates main universe multiverse',
- 'deb http://archive.ubuntu.com/ubuntu '
- 'lucid-security main universe multiverse',
- 'deb http://ppa.launchpad.net/launchpad/ppa/ubuntu lucid main',
- 'deb http://ppa.launchpad.net/bzr/ppa/ubuntu lucid main',
- )
RESOLV_FILE = '/etc/resolv.conf'
@@ -297,7 +293,7 @@
sshcmd = (
'ssh',
'-t',
- '-t', # Yes, this second -t is deliberate. See `man ssh`.
+ '-t', # Yes, this second -t is deliberate. See `man ssh`.
'-o', 'StrictHostKeyChecking=no',
'-o', 'UserKnownHostsFile=/dev/null',
location,
@@ -373,8 +369,9 @@
if option_strings:
args.append(option_strings[0])
if isinstance(value, list):
- value = ','.join(value)
- args.append(value)
+ args.extend(value)
+ elif not isinstance(value, bool):
+ args.append(value)
return args
def _validate(self, namespace):
@@ -727,8 +724,8 @@
uid = pwd.getpwnam(user)[2]
script.write('#!/bin/sh\n')
script.write(
- 'lxc-execute -n lptests --' # Run the named LXC container.
- ' /usr/bin/sudo -u#{} -i'.format(uid)+ # Drop root privileges.
+ 'lxc-execute -n lptests --' # Run the named LXC container.
+ ' /usr/bin/sudo -u#{} -i'.format(uid) + # Drop root privileges.
' make -C /var/lib/buildbot/lp schema\n')
os.chmod(build_script_file, 0555)
# Add a file to sudoers.d that will let the buildbot user run the above.
@@ -812,9 +809,11 @@
root_sshcall = ssh(lxcname)
sshcall = ssh(lxcname, user)
# APT repository update.
- sources = get_container_path(lxcname, '/etc/apt/sources.list')
- with open(sources, 'w') as f:
- f.write('\n'.join(LXC_REPOS))
+ for apt_reposirory in APT_REPOSITORIES:
+ repository = apt_reposirory.format(distro=LXC_GUEST_OS)
+ assume_yes = '' if LXC_GUEST_OS == 'lucid' else '-y'
+ root_sshcall('add-apt-repository {} "{}"'.format(
+ assume_yes, repository))
# XXX frankban 2012-01-13 - Bug 892892: upgrading mountall in LXC
# containers currently does not work.
root_sshcall("echo 'mountall hold' | dpkg --set-selections")
@@ -822,10 +821,10 @@
root_sshcall(
'apt-get update && '
'DEBIAN_FRONTEND=noninteractive '
- 'apt-get -y --allow-unauthenticated install language-pack-en')
+ 'apt-get -y install language-pack-en')
root_sshcall(
'DEBIAN_FRONTEND=noninteractive apt-get -y '
- '--allow-unauthenticated install {}'.format(LP_DEB_DEPENDENCIES))
+ 'install {}'.format(LP_DEB_DEPENDENCIES))
# We install lxc in the guest so that lxc-execute will work on the
# container. We use --no-install-recommends at the recommendation
# of the Canonical lxc maintainers because all we need is a file
@@ -843,8 +842,8 @@
# Set up Launchpad dependencies.
checkout_dir = os.path.join(directory, LP_CHECKOUT)
sshcall(
- 'cd {} && utilities/update-sourcecode --use-http "{}/sourcecode"'.format(
- checkout_dir, dependencies_dir))
+ 'cd {} && utilities/update-sourcecode --use-http '
+ '"{}/sourcecode"'.format(checkout_dir, dependencies_dir))
sshcall(
'cd {} && utilities/link-external-sourcecode "{}"'.format(
checkout_dir, dependencies_dir))