tripleo-upgrade/templates/l3_agent_start_ping.sh.j2
mciecierski 1bbaeef512 Fix ping_results_*.log file name
Fixes ping_results_*.log file name by adding %S to date format string in
order to make it more specific. This solves problem which occurs when
next update steps start at the same hour and minute and writes to the
same file. The problem showed up when new update step 'Update OVN
controllers.' was introduced.[1]

[1]https://review.opendev.org/c/openstack/tripleo-upgrade/+/830743

Change-Id: I78ee113f16897c45fb03f0c9561685ffb531a4e4
2022-03-01 11:59:49 +01:00

30 lines
1.1 KiB
Django/Jinja

#!/bin/bash
#
# Script which start an ICMP connectivity check on the first in use
# floating IP during upgrade
if [ -f {{ working_dir }}/vm_ip.sh ]; then
source {{ working_dir }}/vm_ip.sh
else
{% if workload_sriov | bool %}
echo export VM_IP=$(openstack server list -f json | jq -r -c '.[0]["Networks"]' | cut -d"=" -f2) > {{ working_dir }}/vm_ip.sh
{% else %}
echo export VM_IP=$(openstack floating ip list -f json | jq -r -c '.[] | select(.Port) | .["Floating IP Address"]' | head -1) > {{ working_dir }}/vm_ip.sh
{% endif %}
source {{ working_dir }}/vm_ip.sh
fi
# NOTE: the &>> is necessary as if we don't redirect both
# stdout and stderr we will make any script using this one to
# hang until ping finishes. Meaning if some script crashes
# and should fail in CI it will get stuck if we don't redirect
# both outputs.
# bash
# \ bash <script>
# \ &| awk blah
# If script runs l3 start test and than runs something that fails
# we will make the awk wait until this ping exits as it will hold
# the output pipes. So again &>> instead of >> is necessary.
ping -D ${VM_IP} &>> ~/ping_results_$(date +%Y%m%d%H%M%S).log &