From 94e2f9a4e32289c28945365d9816994c7f46f7d6 Mon Sep 17 00:00:00 2001 From: Peter Martini Date: Thu, 2 Jul 2015 06:56:30 -0400 Subject: [PATCH] Allow env-setup.sh to use alternate url/branches For an offline install, env-setup.sh needs to be able to clone from locations other than GitHub. Additionally, since the ansible repo will have to have its .gitmodules file patched to point submodules to some other location as well, its convenient to allow for alternate branches. As a side-effect, this moves the documentation of what branch we're using to the top of the script for easy reference and removes the duplicated branch name. Change-Id: I7432531915c03638aaf52f836cda607d424351ba --- doc/source/offline-install.rst | 14 ++++++++++++++ scripts/env-setup.sh | 15 +++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/doc/source/offline-install.rst b/doc/source/offline-install.rst index 97907f576..e05463189 100644 --- a/doc/source/offline-install.rst +++ b/doc/source/offline-install.rst @@ -17,6 +17,20 @@ Those steps can be broken down into two general categories; the first being steps that need to be done in your inventory file, and the second being steps that need to be done on your target host outside of Ansible. +Ansible Specific Steps +---------------------- + +The script ``scripts/env-setup.sh`` will do a ``git clone`` to create +``/opt/stack/ansible``, if it doesn't already exist. You can use the +environment variables ``ANSIBLE_GIT_URL`` and ``ANSIBLE_GIT_BRANCH`` +to override the source URL and the branch name to pull from. + +Ansible uses Git submodules, which means if you are cloning from +anything other than the canonical location (GitHub), you'll need +to commit a patched ``.gitmodules`` to that repo so that submodules +are also cloned from an alternate location - otherwise, the submodules +will still try to clone from GitHub. + Bifrost Specific Steps ---------------------- diff --git a/scripts/env-setup.sh b/scripts/env-setup.sh index 961092dbe..b5c1ce968 100755 --- a/scripts/env-setup.sh +++ b/scripts/env-setup.sh @@ -1,6 +1,13 @@ #!/bin/bash set -e +ANSIBLE_GIT_URL=${ANSIBLE_GIT_URL:-https://github.com/ansible/ansible.git} +# NOTE(TheJulia): Switching to Ansible stable-1.9 branch as the development +# branch is undergoing some massive changes and we are seeing odd failures +# that we should not be seeing. Until devel has stabilized, we should stay +# on the stable branch. +ANSIBLE_GIT_BRANCH=${ANSIBLE_GIT_BRANCH:-stable-1.9} + if [ -x '/usr/bin/apt-get' ]; then if ! $(git --version &>/dev/null) ; then sudo -H apt-get -y install git @@ -51,15 +58,11 @@ fi sudo -H chown -R $u:$g /opt/stack cd /opt/stack -# NOTE(TheJulia): Switching to Ansible stable-1.9 branch as the development -# branch is undergoing some massive changes and we are seeing odd failures -# that we should not be seeing. Until devel has stabilized, we should stay -# on the stable branch. if [ ! -d ansible ]; then - git clone https://github.com/ansible/ansible.git --recursive -b stable-1.9 + git clone $ANSIBLE_GIT_URL --recursive -b $ANSIBLE_GIT_BRANCH else cd ansible - git checkout stable-1.9 + git checkout $ANSIBLE_GIT_BRANCH git pull --rebase git submodule update --init --recursive git fetch