From 780c8071b48579cdaf7039125c5bb21a5609e3ba Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 3 Jul 2007 14:56:52 +0100 Subject: [PATCH] userv setup tested and seems to work --- debian/changelog | 6 ++++-- doc/README.userv | 13 +++++++++---- runner/adt-testreport-onepackage | 2 +- virt-subproc/adt-virt-xenlvm | 1 + xen/on-testbed | 8 ++++---- xen/userv-target | 16 ++++++++++++++++ 6 files changed, 35 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index f34aabc..31aaa27 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,11 @@ autopkgtest (0.9.0~iwj) unstable; urgency=low - * WIP userv service use by adt-virt-xenlvm. * userv service for testbed invocation now provided and - at least somewhat tested. + at least somewhat tested, and useable by adt-virt-xenlvm. * New print-execute-command command for virtualisation servers. + * Fix filename pattern bug which can prevent automatic keypair + generation (false claim that privkey and pubkey do not match). + * New adt_sshauthkeys_hook config variable. * Do not demand vg or distro information for initscript to work. * autopkgtest-xenlvm now Recommends: lvm2 and debootstrap. * pass count= to dd for erasure when lvm_erasebase=true. diff --git a/doc/README.userv b/doc/README.userv index 5d98580..8ab93aa 100644 --- a/doc/README.userv +++ b/doc/README.userv @@ -14,9 +14,12 @@ To make this feature available: * Install userv. * Create a group named AdtXenUs containing the users which should be able to manipulate and use the testbed. - * Run adt-xenlvm-setup. NB that the group can be empty at this - point but should exist before setting up the testbed, or the - testbed setup will not be correct. + * Collect the public ssh key(s) of the user(s) and put them in + /etc/autopkgtest/xenlvm_adt_sshauthkeys (this will allow them + to ssh to root@testbed). + * Run adt-xenlvm-setup. NB that the contents of the _sshauthkeys + file (above) are copied into the testbed by adt-xenlvm-setup; + any changes mean that setup needs to be run again. Typically adt-xenlvm-setup ought to be run periodically anyway to make sure that the snapshot doesn't get too out of date. @@ -26,7 +29,9 @@ Client interface ---------------- The service is as invoked as - userv [-Ddistro= -Dnominum=] root adt-xenlvm-testbed + userv [-Ddistro= -Dnominum=] \ + [-Dssh_privkey=...|-Dssh_keyident_args=...] \ + root adt-xenlvm-testbed where is either with Starts adt-xenlvm-with-testbed, prints `y', waits for diff --git a/runner/adt-testreport-onepackage b/runner/adt-testreport-onepackage index 519e402..9b4d83c 100755 --- a/runner/adt-testreport-onepackage +++ b/runner/adt-testreport-onepackage @@ -227,8 +227,8 @@ xrc adt-run --tmp-dir "$tp"/tmp \ --- \ adt-virt-xenlvm \ $adtvirt_extra_opts \ - -- \ --distro="$distro" \ + -- \ 2>&1 3>&- 4>&- printf >&3 "%s " $rc diff --git a/virt-subproc/adt-virt-xenlvm b/virt-subproc/adt-virt-xenlvm index 0d49876..08608da 100755 --- a/virt-subproc/adt-virt-xenlvm +++ b/virt-subproc/adt-virt-xenlvm @@ -95,6 +95,7 @@ def parse_args(): pe('--userv and --gain-root are not compatible') basis = (['userv'] + xargs_userv + xlargs + ['root','adt-xenlvm-testbed']) + with_testbed = basis + ['with'] get_down = subprocess.Popen(basis + ['pon0'], stdin=file('/dev/null'), stdout=subprocess.PIPE, stderr=None) diff --git a/xen/on-testbed b/xen/on-testbed index 24611fd..94af6ba 100755 --- a/xen/on-testbed +++ b/xen/on-testbed @@ -6,12 +6,12 @@ while test $# -gt $nonoptargs; do shift; done : "$1" case "$1" in ---print-command) ppfx=echo; shift ;; ---print0-command) ppfx=ppfx0; shift ;; ---) shift ;; +--print-command) ppfx=echo; r=root@; shift ;; +--print0-command) ppfx=ppfx0; r=root@; shift ;; +--) shift ;; -*) fail "invalid instead-of-command options \`$1'" ;; esac ppfx0 () { for x in "$@"; do printf '%s\0' "$x"; done; } -$ppfx ssh $adt_ssh_keyident_args $adt_guest_ipaddr "$@" +$ppfx ssh $adt_ssh_keyident_args $r$adt_guest_ipaddr "$@" diff --git a/xen/userv-target b/xen/userv-target index 8ba9d1a..37c2c4e 100755 --- a/xen/userv-target +++ b/xen/userv-target @@ -7,6 +7,22 @@ if test -f /etc/lsb-release; then . /etc/lsb-release; fi d="${USERV_U_distro:-$DISTRIB_CODENAME}" n="${USERV_U_nominum:-adt}" +for v in ssh_privkey ssh_keyident_args; do + eval " + if [ \"x\$USERV_U_$v\" != x ]; then + export adt_$v=\"\$USERV_U_$v\" + fi + " +done + +if [ "x$adt_ssh_privkey$adt_ssh_keyident_args" = x ]; then + export adt_ssh_keyident_args=' ' + # There's no point directing userv callers to use the one in + # /root/.ssh/id_dsa_adt* since that one is only readable by + # root. So if they don't specify one we just let them have + # whatever the default is. +fi + nd="${n}_${d}" case "$nd" in -- 2.30.2