progress on getting a working test configuration

This commit is contained in:
Anthony Young 2011-11-10 12:57:59 -08:00
parent 72c84f7999
commit b225682189
5 changed files with 39 additions and 5 deletions

View file

@ -187,6 +187,29 @@ cat > localrc <<LOCAL_EOF
ROOTSLEEP=0
`cat $TOP_DIR/localrc`
LOCAL_EOF
EOF
# Setup stack user with our key
if [ -e ~/.ssh/id_rsa.pub ]; then
cat > $vm_dir/uec/user-data<<EOF
mkdir -p /opt/stack
useradd stack -s /bin/bash -d /opt/stack -G libvirtd || true
echo stack:pass | chpasswd
mkdir -p /opt/stack/.ssh
echo `cat ~/.ssh/id_rsa.pub` > /opt/stack/.ssh/authorized_keys
chown -R stack /opt/stack
chmod 700 /opt/stack/.ssh
chmod 600 /opt/stack/.ssh/authorized_keys
grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers ||
echo "#includedir /etc/sudoers.d" >> /etc/sudoers
( umask 226 && echo "stack ALL=(ALL) NOPASSWD:ALL" \
> /etc/sudoers.d/50_stack_sh )
EOF
fi
# Run stack.sh
cat > $vm_dir/uec/user-data<<EOF
./stack.sh
EOF

View file

@ -1,3 +1,8 @@
#!/bin/bash
# Echo commands, exit on error
set -o xtrace
set -o errexit
echo "$0 SUCCESS!"
TOP_DIR=$(cd ../../.. && pwd)
HEAD_IP=`cat $TOP_DIR/addresses | grep HEAD | cut -d "=" -f2`
ssh stack@$HEAD_IP 'cd devstack && source openrc && cd exercises && ./euca.sh'

View file

@ -49,3 +49,6 @@ $RC
EOF
cd tools
sudo ./build_uec.sh
# Make the address of the instances available to test runners
echo HEAD=`cat /var/lib/libvirt/dnsmasq/$BASE_NAME.leases | cut -d " " -f3` > $TOP_DIR/addresses

View file

@ -10,6 +10,13 @@ if [[ $EUID -ne 0 ]]; then
exit 1
fi
# Make sure user has configured an ssh pubkey
if [ ! -e /root/.ssh/id_rsa.pub ]; then
echo "Public key is missing. This is used to ssh into your instances."
echo "Please run ssh-keygen before proceeding"
exit 1
fi
# This directory
CUR_DIR=$(cd $(dirname "$0") && pwd)

View file

@ -49,10 +49,6 @@ grep -q "^#includedir.*/etc/sudoers.d" $STAGING_DIR/etc/sudoers ||
cp $TOP_DIR/files/sudo/* $STAGING_DIR/etc/sudoers.d/
sed -e "s,%USER%,$USER,g" -i $STAGING_DIR/etc/sudoers.d/*
# and has sudo ability (in the future this should be limited to only what
# stack requires)
echo "stack ALL=(ALL) NOPASSWD: ALL" >> $STAGING_DIR/etc/sudoers
# Gracefully cp only if source file/dir exists
function cp_it {
if [ -e $1 ] || [ -d $1 ]; then