fedora-mirror-update: update logging

We're having trouble with this volume; this makes the logging more
helpful for humans trying to establish the order of things happening.

It turns down the tracing, puts timestamps on the logs messages, makes
the messages more descriptive, and makes sure to timestamp the output
of the vos commands so we can see how long each step took.

Change-Id: Ia832b7ef86350efcbbe7d3b957e820a8a39df3e1
This commit is contained in:
Ian Wienand 2019-08-27 14:09:49 +10:00
parent f3def9b84a
commit b617a08989

View File

@ -1,4 +1,4 @@
#!/bin/bash -xe
#!/bin/bash -e
# Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -15,8 +15,13 @@
MIRROR_VOLUME=$1
function echo_ts {
printf "%(%Y-%m-%d %H:%M:%S)T | %s\n" -1 "$@"
}
if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then
echo "Running interactively"
echo_ts "Running interactively"
set -x
TIMEOUT=""
else
TIMEOUT="timeout -k 2m 30m"
@ -33,13 +38,14 @@ BASE="/afs/.openstack.org/mirror/fedora"
MIRROR="rsync://pubmirror2.math.uh.edu/fedora-buffet/fedora/linux"
K5START="k5start -t -f /etc/fedora.keytab service/fedora-mirror -- ${TIMEOUT}"
echo_ts "----- START FEDORA MIRROR RSYNC RUN -----"
for REPO in releases/28 releases/29 releases/30; do
if ! [ -f $BASE/$REPO ]; then
$K5START mkdir -p $BASE/$REPO
fi
date --iso-8601=ns
echo "Running rsync releases..."
echo_ts "Running rsync for $REPO..."
$K5START rsync -rltDvz \
--delete \
--delete-excluded \
@ -56,6 +62,7 @@ for REPO in releases/28 releases/29 releases/30; do
--exclude="x86_64/debug/" \
--exclude="x86_64/drpms/" \
$MIRROR/$REPO/ $BASE/$REPO/
echo_ts "... done"
done
for REPO in updates/28 updates/29 updates/30; do
@ -63,8 +70,7 @@ for REPO in updates/28 updates/29 updates/30; do
$K5START mkdir -p $BASE/$REPO
fi
date --iso-8601=ns
echo "Running rsync updates..."
echo_ts "Running rsync for $REPO..."
$K5START rsync -rltDvz \
--delete \
--delete-excluded \
@ -76,6 +82,7 @@ for REPO in updates/28 updates/29 updates/30; do
--exclude="x86_64/debug" \
--exclude="x86_64/drpms" \
$MIRROR/$REPO/ $BASE/$REPO/
echo_ts "... done"
done
MIRROR="rsync://pubmirror2.math.uh.edu/fedora-buffet/alt/atomic"
@ -84,8 +91,7 @@ if ! [ -f $BASE/atomic ]; then
$K5START mkdir -p $BASE/atomic
fi
echo "Running rsync atomic..."
date --iso-8601=ns
echo_ts "Running rsync atomic..."
$K5START rsync -rltDvz \
--delete \
--delete-excluded \
@ -104,12 +110,15 @@ $K5START rsync -rltDvz \
--exclude="pxeboot/" \
--exclude="isolinux/" \
$MIRROR/ $BASE/atomic/
echo_ts "... done"
# TODO(pabelanger): Validate rsync process
date --iso-8601=ns | $K5START tee $BASE/timestamp.txt
echo "rsync completed successfully, running vos release."
k5start -t -f /etc/afsadmin.keytab service/afsadmin -- vos release -v $MIRROR_VOLUME
date --iso-8601=ns
echo "Done."
echo_ts "Running vos release."
k5start -t -f /etc/afsadmin.keytab service/afsadmin -- vos release -v $MIRROR_VOLUME | \
while IFS= read -r line; do echo_ts "$line"; done
echo_ts "... done"
echo_ts "----- END FEDORA MIRROR RSYNC RUN -----"
printf "\n\n"