From c88534e16966f5f0b65183e584bb6cbd3058a26e Mon Sep 17 00:00:00 2001 From: Toby Oxborrow Date: Wed, 7 Oct 2015 11:03:48 +0800 Subject: [PATCH] Fix run-aio-build.sh for curl one-liner The developer documentation to run an AIO build includes a curl one-liner to run the scripts/run-aio-build.sh script. However, due to the way it sources other scripts it will fail to execute. This change sources those scripts in a way to allow them to be run from curl piped to bash and also from a local git checkout. * In run-aio-build.sh it has cd to a fresh checkout so the path can be assumed and hard-coded. * In bootstrap-aio.sh and bootstrap-ansible.sh we now test the existing behaviour first (which will work if you executed these scripts directly from a git checkout) or from a scripts subdirectory of the currrent path (which will work if you ran the curl one-liner). Example of documentation which includes the curl one-liner: http://docs.openstack.org/developer/openstack-ansible/developer-docs/quickstart-aio.html#running-an-aio-build-in-one-step The curl one-liner: curl https://raw.githubusercontent.com/openstack/openstack-ansible/master/scripts/run-aio-build.sh | sudo bash Closes-Bug: #1504198 Change-Id: I2f8629f7cc4a1b650e8b5f6c6881168c0c5abde0 --- scripts/bootstrap-aio.sh | 4 +++- scripts/bootstrap-ansible.sh | 5 +++-- scripts/run-aio-build.sh | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/bootstrap-aio.sh b/scripts/bootstrap-aio.sh index 092b3f92aa..ebee530b3b 100755 --- a/scripts/bootstrap-aio.sh +++ b/scripts/bootstrap-aio.sh @@ -51,7 +51,9 @@ UBUNTU_SEC_REPO=${UBUNTU_SEC_REPO:-$(awk "/^deb .*ubuntu\/? ${UBUNTU_RELEASE}-se ## Library Check ------------------------------------------------------------- -info_block "Checking for required libraries." 2> /dev/null || source $(dirname ${0})/scripts-library.sh +info_block "Checking for required libraries." 2> /dev/null || + source $(dirname ${0})/scripts-library.sh || + source scripts/scripts-library.sh ## Main ---------------------------------------------------------------------- diff --git a/scripts/bootstrap-ansible.sh b/scripts/bootstrap-ansible.sh index b3718e3119..9507be074f 100755 --- a/scripts/bootstrap-ansible.sh +++ b/scripts/bootstrap-ansible.sh @@ -30,8 +30,9 @@ export DEBIAN_FRONTEND=${DEBIAN_FRONTEND:-"noninteractive"} ## Functions ----------------------------------------------------------------- -info_block "Checking for required libraries." 2> /dev/null || source $(dirname ${0})/scripts-library.sh - +info_block "Checking for required libraries." 2> /dev/null || + source $(dirname ${0})/scripts-library.sh || + source scripts/scripts-library.sh ## Main ---------------------------------------------------------------------- info_block "Bootstrapping System with Ansible" diff --git a/scripts/run-aio-build.sh b/scripts/run-aio-build.sh index 97d0bcaae8..7a052fb258 100755 --- a/scripts/run-aio-build.sh +++ b/scripts/run-aio-build.sh @@ -38,13 +38,13 @@ git clone -b ${REPO_BRANCH} ${REPO_URL} ${WORKING_FOLDER} cd ${WORKING_FOLDER} # first, bootstrap the AIO host -source $(dirname ${0})/bootstrap-aio.sh +source scripts/bootstrap-aio.sh # next, bootstrap Ansible -source $(dirname ${0})/bootstrap-ansible.sh +source scripts/bootstrap-ansible.sh # finally, run all the playbooks -bash $(dirname ${0})/run-playbooks.sh +bash scripts/run-playbooks.sh # put a motd in place to help the user know what stuff is accessible once the build is complete cat > /etc/update-motd.d/20-openstack<< EOF