Te-broker: save all nodes console to html log dir

THis change gathers all nodes console and put them into a html log
directory, divided by node name. They can be retrieved by the job with a
curl so they are gathered with the job log itself.

Change-Id: I8ac885eb61dd633238bcdb4c9bc11de8974d37f6
This commit is contained in:
Gabriele Cerami 2018-08-03 10:35:57 +01:00 committed by Quique Llorente
parent 51548c7635
commit 3bf6bb2a2c
1 changed files with 10 additions and 0 deletions

View File

@ -32,8 +32,18 @@ function delete_ports() {
}
# Save the end of the bmc log for debugging IPMI connectivity problems
PYTHONIOENCODING='utf-8'
CONSOLE_LOG_PATH=/var/www/html/tebroker/console-logs/
nova console-log bmc-${ENVNUM} | tail -n 100 | awk -v envnum="$ENVNUM" '$0=envnum ": " $0' >> /var/log/bmc-console-logs
# Save all the consoles in the stack to a dedicated directory, stripping out ANSI color codes.
for server in $(openstack server list -f value -c Name | grep baremetal-${ENVNUM}) bmc-$ENVNUM
do
openstack console log show $server | sed 's/\[[0-9;]*[a-zA-Z]//g' | gzip > $CONSOLE_LOG_PATH/$server-console.log.gz || true
done
# Delete the ports that have been attached to the undercloud
SUBNETID=$(neutron subnet-show $PUBLICNET | awk '$2=="id" {print $4}' || echo '')
delete_ports $SUBNETID