Put devstack-version info into separate file

As a follow on to I4c269a7f3d63ee9a976e7c3636fc3e5e8dab9ae3; the
quoting gets tricky when putting arbitrary command-substitution
strings into saved echo-able strings.  As they say, "the only winning
move is not to play" :)

An alternative proposal is to not write this into a script but just
dump info into a file.  To my mind, this has several advantages --
avoid getting involved in quoting, not dropping a script into the
global environment -- it's just as easy to "cat" -- and the plain-text
file can be collected as an artifact during log collection (also moved
git commit line to separate line for easier parsing during log search,
etc).

-- Note

This is a combined cherry-pick of the following

 2c0faca038 - add version
 3415521d56 - fix to ^
 07cbc44942 - this change

2c0faca and 3415522 were not merged to this branch at the time to
avoid breakage.  This brings consistency across the open branches.

Change-Id: Ic7391dd087657c0daf74046e4a052c53f4eb6e1a
This commit is contained in:
Sean Dague 2017-06-28 09:13:04 -04:00 committed by Ian Wienand
parent 6e02b553b0
commit 76a3ae6ca2
3 changed files with 20 additions and 0 deletions

View File

@ -691,6 +691,18 @@ function enable_kernel_bridge_firewall {
done
}
# Save some state information
#
# Write out various useful state information to /etc/devstack-version
function write_devstack_version {
cat - > /tmp/devstack-version <<EOF
DevStack Version: ${DEVSTACK_SERIES}
Change: $(git log --format="%H %s %ci" -1)
OS Version: ${os_VENDOR} ${os_RELEASE} ${os_CODENAME}
EOF
sudo install -m 644 /tmp/devstack-version /etc/devstack-version
rm /tmp/devstack-version
}
# Restore xtrace
$_XTRACE_FUNCTIONS

View File

@ -190,6 +190,9 @@ if [[ ! -r $TOP_DIR/stackrc ]]; then
fi
source $TOP_DIR/stackrc
# write /etc/devstack-version
write_devstack_version
# Warn users who aren't on an explicitly supported distro, but allow them to
# override check and attempt installation with ``FORCE=yes ./stack``
if [[ ! ${DISTRO} =~ (trusty|xenial|yakkety|7.0|wheezy|sid|testing|jessie|f23|f24|f25|rhel7|kvmibm1) ]]; then
@ -1454,6 +1457,10 @@ if [[ -n "$DEPRECATED_TEXT" ]]; then
echo_summary "WARNING: $DEPRECATED_TEXT"
fi
# Useful info on current state
cat /etc/devstack-version
echo
# Indicate how long this took to run (bash maintained variable ``SECONDS``)
echo_summary "stack.sh completed in $SECONDS seconds."

View File

@ -216,6 +216,7 @@ REQUIREMENTS_DIR=$DEST/requirements
# Setting the variable to 'ALL' will activate the download for all
# libraries.
DEVSTACK_SERIES="ocata"
##############
#