Merge "Support installing the openstack collection from a local location"

This commit is contained in:
Zuul 2020-07-27 11:34:31 +00:00 committed by Gerrit Code Review
commit 6f46778ffa

View File

@ -9,6 +9,10 @@ DEFAULT_PIP_ANSIBLE='>=2.9,<2.10'
ANSIBLE_PIP_VERSION=${ANSIBLE_PIP_VERSION:-${DEFAULT_PIP_ANSIBLE}} ANSIBLE_PIP_VERSION=${ANSIBLE_PIP_VERSION:-${DEFAULT_PIP_ANSIBLE}}
ANSIBLE_SOURCE_PATH=${ANSIBLE_SOURCE_PATH:-ansible${ANSIBLE_PIP_VERSION}} ANSIBLE_SOURCE_PATH=${ANSIBLE_SOURCE_PATH:-ansible${ANSIBLE_PIP_VERSION}}
ANSIBLE_COLLECTION_SOURCE_PATH=
if [[ -d "${WORKSPACE:-}/openstack/ansible-collections-openstack" ]]; then
ANSIBLE_COLLECTION_SOURCE_PATH="${WORKSPACE}/openstack/ansible-collections-openstack"
fi
ANSIBLE_COLLECTION_REQ=${ANSIBLE_COLLECTION_REQ:-$(dirname $0)/../ansible-collection-requirements.yml} ANSIBLE_COLLECTION_REQ=${ANSIBLE_COLLECTION_REQ:-$(dirname $0)/../ansible-collection-requirements.yml}
BIFROST_COLLECTIONS_PATHS=${ANSIBLE_COLLECTIONS_PATHS:-} BIFROST_COLLECTIONS_PATHS=${ANSIBLE_COLLECTIONS_PATHS:-}
@ -21,6 +25,10 @@ if [ -n "${VENV-}" ]; then
export ANSIBLE_COLLECTIONS_PATHS=${VENV}/collections export ANSIBLE_COLLECTIONS_PATHS=${VENV}/collections
BIFROST_COLLECTIONS_PATHS=$ANSIBLE_COLLECTIONS_PATHS BIFROST_COLLECTIONS_PATHS=$ANSIBLE_COLLECTIONS_PATHS
fi fi
if [[ -n "$ANSIBLE_COLLECTION_SOURCE_PATH" ]]; then
mkdir -p "$BIFROST_COLLECTIONS_PATHS/ansible_collections/openstack"
ln -s "$ANSIBLE_COLLECTION_SOURCE_PATH" "$BIFROST_COLLECTIONS_PATHS/ansible_collections/openstack/cloud"
fi
else else
${PIP} install --user --upgrade "${ANSIBLE_SOURCE_PATH}" ${PIP} install --user --upgrade "${ANSIBLE_SOURCE_PATH}"
ANSIBLE=${HOME}/.local/bin/ansible ANSIBLE=${HOME}/.local/bin/ansible
@ -44,8 +52,9 @@ sudo -H chown -R $u:$g ${ANSIBLE_INSTALL_ROOT}
# Install Collections # Install Collections
if [[ -z $BIFROST_COLLECTIONS_PATHS ]]; if [[ -n "$ANSIBLE_COLLECTION_SOURCE_PATH" ]]; then
then echo "Using openstack ansible collection from $ANSIBLE_COLLECTION_SOURCE_PATH"
elif [[ -z $BIFROST_COLLECTIONS_PATHS ]]; then
echo "Installing ansible collections on default collections path" echo "Installing ansible collections on default collections path"
${ANSIBLE_GALAXY} collection install -r ${ANSIBLE_COLLECTION_REQ} ${ANSIBLE_GALAXY} collection install -r ${ANSIBLE_COLLECTION_REQ}
else else