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). Change-Id: Ic7391dd087657c0daf74046e4a052c53f4eb6e1a
This commit is contained in:
parent
3415521d56
commit
07cbc44942
17
functions
17
functions
@ -750,19 +750,16 @@ function get_random_port {
|
|||||||
echo $port
|
echo $port
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Save some state information
|
||||||
|
#
|
||||||
|
# Write out various useful state information to /etc/devstack-version
|
||||||
function write_devstack_version {
|
function write_devstack_version {
|
||||||
pushd $TOP_DIR
|
|
||||||
local git_version=""
|
|
||||||
git_version=$(git log --format="%H %ci" -1)
|
|
||||||
cat - > /tmp/devstack-version <<EOF
|
cat - > /tmp/devstack-version <<EOF
|
||||||
#!/bin/bash
|
DevStack Version: ${DEVSTACK_SERIES}
|
||||||
|
Change: $(git log --format="%H %s %ci" -1)
|
||||||
echo "DevStack Version: ${DEVSTACK_SERIES} - ${git_version}"
|
OS Version: ${os_VENDOR} ${os_RELEASE} ${os_CODENAME}
|
||||||
echo "OS Version: ${os_VENDOR} ${os_RELEASE} ${os_CODENAME}"
|
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
sudo install -m 755 /tmp/devstack-version /usr/local/bin/devstack-version
|
sudo install -m 644 /tmp/devstack-version /etc/devstack-version
|
||||||
rm /tmp/devstack-version
|
rm /tmp/devstack-version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
stack.sh
6
stack.sh
@ -216,7 +216,7 @@ if [[ ! -r $TOP_DIR/stackrc ]]; then
|
|||||||
fi
|
fi
|
||||||
source $TOP_DIR/stackrc
|
source $TOP_DIR/stackrc
|
||||||
|
|
||||||
# this installs a devstack-version script to make it easy to report the version back
|
# write /etc/devstack-version
|
||||||
write_devstack_version
|
write_devstack_version
|
||||||
|
|
||||||
# Warn users who aren't on an explicitly supported distro, but allow them to
|
# Warn users who aren't on an explicitly supported distro, but allow them to
|
||||||
@ -1538,8 +1538,8 @@ if [[ "$USE_SYSTEMD" == "True" ]]; then
|
|||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# devstack version
|
# Useful info on current state
|
||||||
devstack-version
|
cat /etc/devstack-version
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Indicate how long this took to run (bash maintained variable ``SECONDS``)
|
# Indicate how long this took to run (bash maintained variable ``SECONDS``)
|
||||||
|
Loading…
Reference in New Issue
Block a user