mirror of
https://github.com/ansible/awx-operator.git
synced 2026-03-26 21:33:14 +00:00
Add background keepalive to awx-manage migrate (#1589)
This commit is contained in:
@@ -96,8 +96,26 @@
|
|||||||
namespace: "{{ ansible_operator_meta.namespace }}"
|
namespace: "{{ ansible_operator_meta.namespace }}"
|
||||||
pod: "{{ awx_task_pod_name }}"
|
pod: "{{ awx_task_pod_name }}"
|
||||||
container: "{{ ansible_operator_meta.name }}-task"
|
container: "{{ ansible_operator_meta.name }}-task"
|
||||||
command: >-
|
command: |
|
||||||
bash -c "awx-manage migrate --noinput"
|
bash -c "
|
||||||
|
function end_keepalive {
|
||||||
|
rc=$?
|
||||||
|
rm -f \"$1\"
|
||||||
|
kill $(cat /proc/$2/task/$2/children 2>/dev/null) 2>/dev/null || true
|
||||||
|
wait $2 || true
|
||||||
|
exit $rc
|
||||||
|
}
|
||||||
|
keepalive_file=\"$(mktemp)\"
|
||||||
|
while [[ -f \"$keepalive_file\" ]]; do
|
||||||
|
echo 'Database schema migration in progress...'
|
||||||
|
sleep 60
|
||||||
|
done &
|
||||||
|
keepalive_pid=$!
|
||||||
|
trap 'end_keepalive \"$keepalive_file\" \"$keepalive_pid\"' EXIT SIGINT SIGTERM
|
||||||
|
echo keepalive_pid: $keepalive_pid
|
||||||
|
awx-manage migrate --noinput
|
||||||
|
echo 'Successful'
|
||||||
|
"
|
||||||
register: migrate_result
|
register: migrate_result
|
||||||
when:
|
when:
|
||||||
- awx_task_pod_name != ''
|
- awx_task_pod_name != ''
|
||||||
|
|||||||
Reference in New Issue
Block a user