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
This commit is contained in:
Toby Oxborrow 2015-10-07 11:03:48 +08:00 committed by Jesse Pretorius
parent 0ec13cbb35
commit c88534e169
3 changed files with 9 additions and 6 deletions

View File

@ -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 ----------------------------------------------------------------------

View File

@ -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"

View File

@ -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