Mark OSA version in the wrapper script
By doing that, we compute (every bootstrap ansible) the version of OSA, which can then be used in playbooks using a lookup. This would be faster than doing the lookup in the variable, as this would be computed once, gaining around 0.4s per playbook. Change-Id: Idd3a842f94eb30dec2afa6da84615a8605ef9e78
This commit is contained in:
parent
f5bcc2f103
commit
c44fbcbbe3
@ -113,6 +113,9 @@ fi
|
||||
PYTHON_EXEC_PATH="${PYTHON_EXEC_PATH:-$(which python2 || which python)}"
|
||||
PYTHON_VERSION="$($PYTHON_EXEC_PATH -c 'import sys; print(".".join(map(str, sys.version_info[:3])))')"
|
||||
|
||||
# Get current code version (this runs at the root of OSA clone)
|
||||
CURRENT_OSA_VERSION=$(cd ${OSA_CLONE_DIR}; ${PYTHON_EXEC_PATH} setup.py --version)
|
||||
|
||||
# Use https when Python with native SNI support is available
|
||||
UPPER_CONSTRAINTS_PROTO=$([ "$PYTHON_VERSION" == $(echo -e "$PYTHON_VERSION\n2.7.9" | sort -V | tail -1) ] && echo "https" || echo "http")
|
||||
|
||||
@ -177,6 +180,8 @@ sed -i "s|OSA_PLAYBOOK_PATH|${OSA_PLAYBOOK_PATH}|g" /usr/local/bin/openstack-ans
|
||||
# Create openstack ansible wrapper tool
|
||||
cp -v ${OSA_WRAPPER_BIN} /usr/local/bin/openstack-ansible
|
||||
sed -i "s|OSA_CLONE_DIR|${OSA_CLONE_DIR}|g" /usr/local/bin/openstack-ansible
|
||||
# Mark the current OSA version in the wrapper, so we don't need to compute it everytime.
|
||||
sed -i "s|CURRENT_OSA_VERSION|${CURRENT_OSA_VERSION}|g" /usr/local/bin/openstack-ansible
|
||||
|
||||
# Ensure wrapper tool is executable
|
||||
chmod +x /usr/local/bin/openstack-ansible
|
||||
|
@ -18,6 +18,7 @@
|
||||
# OpenStack wrapper tool to ease the use of ansible with multiple variable files.
|
||||
|
||||
export PATH="/opt/ansible-runtime/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PATH}"
|
||||
export OSA_VERSION="CURRENT_OSA_VERSION"
|
||||
|
||||
function info {
|
||||
if [ "${ANSIBLE_NOCOLOR:-0}" -eq "1" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user