From a6ece2cacc37949ab9b56d9d05383284934de553 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 14 Sep 2022 08:22:14 +1000 Subject: [PATCH] mirror-update: make jobs interactive by default If you are running these jobs by hand you are doing something that will be expected to take a long time (initial sync, recovery, etc.). Make these scripts assume interactivity and default to *not* running under timeout -- it's too easy to forget NO_TIMEOUT when running manually and having the job killed. We already have an UNDER_CRON variable set so that we only send stats when running ... under cron. Reuse this here for the timeout flag. Change-Id: Ic2d2f39bb18d247c853284512fe0dc37485c00a4 --- doc/source/afs.rst | 2 +- playbooks/roles/mirror-update/files/centos-mirror-update | 8 +++++--- .../roles/mirror-update/files/centos-stream-mirror-update | 8 +++++--- playbooks/roles/mirror-update/files/epel-mirror-update | 8 +++++--- playbooks/roles/mirror-update/files/fedora-mirror-update | 7 ++++--- .../roles/mirror-update/files/openeuler-mirror-update | 6 ++++-- .../roles/mirror-update/files/opensuse-mirror-update | 8 +++++--- .../mirror-update/files/yum-puppetlabs-mirror-update | 8 +++++--- playbooks/roles/reprepro/files/reprepro-mirror-update | 5 ++--- 9 files changed, 36 insertions(+), 24 deletions(-) diff --git a/doc/source/afs.rst b/doc/source/afs.rst index 2c97bd7399..d97341c237 100644 --- a/doc/source/afs.rst +++ b/doc/source/afs.rst @@ -528,7 +528,7 @@ our mirror update cron jobs, manually perform the first mirror update: ``timeout`` with shorter periods than may be required for the initial full sync. e.g. for ``reprepro`` mirrors - NO_TIMEOUT=1 /usr/local/bin/reprepro-mirror-update /etc/reprepro/ubuntu mirror.ubuntu + /usr/local/bin/reprepro-mirror-update /etc/reprepro/ubuntu mirror.ubuntu * Log into ``afs01.dfw.openstack.org`` and run ``screen``. Within that session, periodically during the sync, and once again after it diff --git a/playbooks/roles/mirror-update/files/centos-mirror-update b/playbooks/roles/mirror-update/files/centos-mirror-update index 5f3c0db3c4..f68544cfd7 100755 --- a/playbooks/roles/mirror-update/files/centos-mirror-update +++ b/playbooks/roles/mirror-update/files/centos-mirror-update @@ -17,11 +17,13 @@ source /usr/share/mirror-update/functions.sh MIRROR_VOLUME=$1 -if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then - echo "Running interactively" +# Runs with timeout under cron +if [[ ${UNDER_CRON:-0} -eq 0 ]]; then + echo_ts "Running interactively" TIMEOUT="" + set -x else - TIMEOUT="timeout -k 2m 30m" + TIMEOUT="timeout -k 2m 90m" fi _DRY_RUN='' diff --git a/playbooks/roles/mirror-update/files/centos-stream-mirror-update b/playbooks/roles/mirror-update/files/centos-stream-mirror-update index 4e9de7fa2b..56f10eb216 100755 --- a/playbooks/roles/mirror-update/files/centos-stream-mirror-update +++ b/playbooks/roles/mirror-update/files/centos-stream-mirror-update @@ -17,11 +17,13 @@ source /usr/share/mirror-update/functions.sh MIRROR_VOLUME=$1 -if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then - echo "Running interactively" +# Runs with timeout under cron +if [[ ${UNDER_CRON:-0} -eq 0 ]]; then + echo_ts "Running interactively" TIMEOUT="" + set -x else - TIMEOUT="timeout -k 2m 30m" + TIMEOUT="timeout -k 2m 90m" fi _DRY_RUN='' diff --git a/playbooks/roles/mirror-update/files/epel-mirror-update b/playbooks/roles/mirror-update/files/epel-mirror-update index ab5e39a0a0..ac2e6f5641 100755 --- a/playbooks/roles/mirror-update/files/epel-mirror-update +++ b/playbooks/roles/mirror-update/files/epel-mirror-update @@ -17,11 +17,13 @@ source /usr/share/mirror-update/functions.sh MIRROR_VOLUME=$1 -if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then - echo "Running interactively" +# Runs with timeout under cron +if [[ ${UNDER_CRON:-0} -eq 0 ]]; then + echo_ts "Running interactively" TIMEOUT="" + set -x else - TIMEOUT="timeout -k 2m 30m" + TIMEOUT="timeout -k 2m 90m" fi BASE="/afs/.openstack.org/mirror/epel" diff --git a/playbooks/roles/mirror-update/files/fedora-mirror-update b/playbooks/roles/mirror-update/files/fedora-mirror-update index 8079d25c5a..e0fa57ce01 100755 --- a/playbooks/roles/mirror-update/files/fedora-mirror-update +++ b/playbooks/roles/mirror-update/files/fedora-mirror-update @@ -17,12 +17,13 @@ source /usr/share/mirror-update/functions.sh MIRROR_VOLUME=$1 -if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then +# Runs with timeout under cron +if [[ ${UNDER_CRON:-0} -eq 0 ]]; then echo_ts "Running interactively" - set -x TIMEOUT="" + set -x else - TIMEOUT="timeout -k 2m 30m" + TIMEOUT="timeout -k 2m 90m" fi BASE="/afs/.openstack.org/mirror/fedora" diff --git a/playbooks/roles/mirror-update/files/openeuler-mirror-update b/playbooks/roles/mirror-update/files/openeuler-mirror-update index d9c867055c..0965d52abe 100644 --- a/playbooks/roles/mirror-update/files/openeuler-mirror-update +++ b/playbooks/roles/mirror-update/files/openeuler-mirror-update @@ -20,11 +20,13 @@ source /usr/share/mirror-update/functions.sh MIRROR_VOLUME=$1 -if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then +# Runs with timeout under cron +if [[ ${UNDER_CRON:-0} -eq 0 ]]; then echo_ts "Running interactively" TIMEOUT="" + set -x else - TIMEOUT="timeout -k 2m 30m" + TIMEOUT="timeout -k 2m 90m" fi BASE="/afs/.openstack.org/mirror/openeuler" diff --git a/playbooks/roles/mirror-update/files/opensuse-mirror-update b/playbooks/roles/mirror-update/files/opensuse-mirror-update index 91b8089991..2b25ef56e5 100755 --- a/playbooks/roles/mirror-update/files/opensuse-mirror-update +++ b/playbooks/roles/mirror-update/files/opensuse-mirror-update @@ -17,11 +17,13 @@ source /usr/share/mirror-update/functions.sh MIRROR_VOLUME=$1 -if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then - echo "Running interactively" +# Runs with timeout under cron +if [[ ${UNDER_CRON:-0} -eq 0 ]]; then + echo_ts "Running interactively" TIMEOUT="" + set -x else - TIMEOUT="timeout -k 2m 30m" + TIMEOUT="timeout -k 2m 90m" fi BASE="/afs/.openstack.org/mirror/opensuse" diff --git a/playbooks/roles/mirror-update/files/yum-puppetlabs-mirror-update b/playbooks/roles/mirror-update/files/yum-puppetlabs-mirror-update index 2a5fe21d13..9d5861fbc5 100755 --- a/playbooks/roles/mirror-update/files/yum-puppetlabs-mirror-update +++ b/playbooks/roles/mirror-update/files/yum-puppetlabs-mirror-update @@ -17,11 +17,13 @@ source /usr/share/mirror-update/functions.sh MIRROR_VOLUME=$1 -if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then - echo "Running interactively" +# Runs with timeout under cron +if [[ ${UNDER_CRON:-0} -eq 0 ]]; then + echo_ts "Running interactively" TIMEOUT="" + set -x else - TIMEOUT="timeout -k 2m 30m" + TIMEOUT="timeout -k 2m 90m" fi BASE="/afs/.openstack.org/mirror/yum-puppetlabs" diff --git a/playbooks/roles/reprepro/files/reprepro-mirror-update b/playbooks/roles/reprepro/files/reprepro-mirror-update index 14b8044e53..3dd2bcf08e 100644 --- a/playbooks/roles/reprepro/files/reprepro-mirror-update +++ b/playbooks/roles/reprepro/files/reprepro-mirror-update @@ -16,9 +16,8 @@ source /usr/share/mirror-update/functions.sh -# For initial clones, and debugging, set this for more verbose output -# that doesn't time out. -if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then +# Runs with timeout under cron +if [[ ${UNDER_CRON:-0} -eq 0 ]]; then echo_ts "Running interactively" TIMEOUT="" set -x