Change directories less.

Remove most of the cd commands, referencing the full path to
commands instead. This is mainly done in order to make it easier
to paste various commands fromt he toci_* scripts

Also write out the file $TOCI_WORKING_DIR/toci_env at the end of
a toci run, that can be sourced so it is easier to use toci and
a script to setup a dev environment
This commit is contained in:
Derek Higgins 2013-06-19 18:00:58 +01:00
parent 54c4de31c4
commit fd5940a83b
4 changed files with 17 additions and 18 deletions

View File

@ -80,4 +80,5 @@ if [ ${TOCI_REMOVE:-1} == 1 ] ; then
rm -rf $TOCI_WORKING_DIR $TOCI_LOG_DIR
fi
declare | grep -e "^TOCI" > $TOCI_WORKING_DIR/toci_env
echo $STATUS

View File

@ -5,9 +5,10 @@ get_get_repo(){
if [ ! -e $CACHDIR ] ; then
git clone https://github.com/$1.git $CACHDIR
else
cd $CACHDIR
pushd $CACHDIR
git fetch
git reset --hard origin/master
popd
fi
cp -r $CACHDIR $TOCI_WORKING_DIR/${1/[^\/]*\//}
}
@ -34,12 +35,13 @@ wait_for(){
}
apply_patches(){
cd $TOCI_WORKING_DIR/$1
pushd $TOCI_WORKING_DIR/$1
if [ -d "$TOCI_SOURCE_DIR/patches/" ]; then
for PATCH in $(find $TOCI_SOURCE_DIR/patches/ -name "$2") ; do
patch -p1 -N < $PATCH || echo Error : could not apply $PATCH >> $TOCI_LOG_DIR/error-applying-patches.log
done
fi
popd
}
mark_time(){

View File

@ -3,17 +3,17 @@
set -xe
. toci_functions.sh
cd $TOCI_WORKING_DIR
# install deps on host machine
cd $TOCI_WORKING_DIR/incubator
./scripts/install-dependencies
$TOCI_WORKING_DIR/incubator/scripts/install-dependencies
id | grep libvirt || ( echo "You have been added to the libvirt group, this script will now exit but will succeed if run again in a new shell" ; exit 1 )
# looks like libvirt somtimes takes a little time to start
wait_for 3 3 ls /var/run/libvirt/libvirt-sock
cd $TOCI_WORKING_DIR/bm_poseur
sudo ./bm_poseur --bridge-ip=none create-bridge || true
sudo $TOCI_WORKING_DIR/bm_poseur/bm_poseur --bridge-ip=none create-bridge || true
if [ -f /etc/init.d/libvirt-bin ]; then
sudo service libvirt-bin restart
@ -21,8 +21,6 @@ else
sudo service libvirtd restart
fi
cd $TOCI_WORKING_DIR/incubator
# custom power driver config
if [ -n "$TOCI_PM_DRIVER" ]; then
sed -i "s/\"power_manager\":.*,/\"power_manager\": \"$TOCI_PM_DRIVER\",/" $TOCI_WORKING_DIR/tripleo-image-elements/elements/boot-stack/config.json
@ -31,15 +29,13 @@ fi
sed -i "s/\"user\": \"stack\",/\"user\": \"`whoami`\",/" $TOCI_WORKING_DIR/tripleo-image-elements/elements/boot-stack/config.json
ELEMENTS_PATH=$TOCI_WORKING_DIR/tripleo-image-elements/elements \
DIB_PATH=$TOCI_WORKING_DIR/diskimage-builder \
scripts/boot-elements boot-stack -o bootstrap
$TOCI_WORKING_DIR/incubator/scripts/boot-elements boot-stack -o bootstrap
cd $TOCI_WORKING_DIR
export ELEMENTS_PATH=$TOCI_WORKING_DIR/diskimage-builder/elements:$TOCI_WORKING_DIR/tripleo-image-elements/elements
./diskimage-builder/bin/disk-image-create -u -a i386 -o $TOCI_WORKING_DIR/incubator/notcompute stackuser boot-stack heat-cfntools quantum-network-node
./diskimage-builder/bin/disk-image-create -u -a i386 -o $TOCI_WORKING_DIR/incubator/compute stackuser nova-compute heat-cfntools
$TOCI_WORKING_DIR/diskimage-builder/bin/disk-image-create -u -a i386 -o $TOCI_WORKING_DIR/notcompute stackuser boot-stack heat-cfntools quantum-network-node
$TOCI_WORKING_DIR/diskimage-builder/bin/disk-image-create -u -a i386 -o $TOCI_WORKING_DIR/compute stackuser nova-compute heat-cfntools quantum-openvswitch-agent
cd $TOCI_WORKING_DIR/incubator
BOOTSTRAP_IP=`scripts/get-vm-ip bootstrap`
BOOTSTRAP_IP=`$TOCI_WORKING_DIR/incubator/scripts/get-vm-ip bootstrap`
# Get logs from the node on error
trap get_state_from_host ERR

View File

@ -3,8 +3,8 @@
set -xe
. toci_functions.sh
cd $TOCI_WORKING_DIR/incubator
BOOTSTRAP_IP=`scripts/get-vm-ip bootstrap`
cd $TOCI_WORKING_DIR
BOOTSTRAP_IP=`$TOCI_WORKING_DIR/incubator/scripts/get-vm-ip bootstrap`
# Get logs from the node on exit
trap get_state_from_host EXIT
@ -37,8 +37,8 @@ fi
# Load the base image into glance
export DIB_PATH=$TOCI_WORKING_DIR/diskimage-builder
./scripts/load-image notcompute.qcow2
./scripts/load-image compute.qcow2
$TOCI_WORKING_DIR/incubator/scripts/load-image notcompute.qcow2
$TOCI_WORKING_DIR/incubator/scripts/load-image compute.qcow2
keystone role-create --name heat_stack_user