centos-mirror: add dry run mode
Add a dry-run flag and abstract the rsync command to make for easier testing if modifying the copy flags. Change-Id: Ie658b60257b94436b1eda0cddf6deb639a87d659
This commit is contained in:
parent
3d5d2779d2
commit
917544546f
@ -24,6 +24,14 @@ else
|
|||||||
TIMEOUT="timeout -k 2m 30m"
|
TIMEOUT="timeout -k 2m 30m"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
_DRY_RUN=''
|
||||||
|
if [[ ${DRY_RUN:-0} -eq 1 ]]; then
|
||||||
|
echo "Dry run only"
|
||||||
|
_DRY_RUN='--dry-run'
|
||||||
|
fi
|
||||||
|
|
||||||
|
RSYNC="rsync ${_DRY_RUN} -rltvz"
|
||||||
|
|
||||||
BASE="/afs/.openstack.org/mirror/centos"
|
BASE="/afs/.openstack.org/mirror/centos"
|
||||||
K5START="k5start -t -f /etc/centos.keytab service/centos-mirror -- $TIMEOUT"
|
K5START="k5start -t -f /etc/centos.keytab service/centos-mirror -- $TIMEOUT"
|
||||||
|
|
||||||
@ -38,7 +46,7 @@ if ! [ -f $BASE/8-stream ]; then
|
|||||||
fi
|
fi
|
||||||
date --iso-8601=ns
|
date --iso-8601=ns
|
||||||
echo "Running Centos 8-stream rsync..."
|
echo "Running Centos 8-stream rsync..."
|
||||||
$K5START rsync -rltvz \
|
$K5START ${RSYNC} \
|
||||||
--delete \
|
--delete \
|
||||||
--delete-excluded \
|
--delete-excluded \
|
||||||
--exclude="isos" \
|
--exclude="isos" \
|
||||||
@ -56,7 +64,7 @@ if ! [ -f $BASE/8 ]; then
|
|||||||
fi
|
fi
|
||||||
date --iso-8601=ns
|
date --iso-8601=ns
|
||||||
echo "Running Centos 8 rsync..."
|
echo "Running Centos 8 rsync..."
|
||||||
$K5START rsync -rltvz \
|
$K5START ${RSYNC} \
|
||||||
--delete \
|
--delete \
|
||||||
--delete-excluded \
|
--delete-excluded \
|
||||||
--exclude="isos" \
|
--exclude="isos" \
|
||||||
@ -94,7 +102,7 @@ for REPO in $REPOS; do
|
|||||||
|
|
||||||
date --iso-8601=ns
|
date --iso-8601=ns
|
||||||
echo "Running rsync..."
|
echo "Running rsync..."
|
||||||
$K5START rsync -rltvz \
|
$K5START ${RSYNC} \
|
||||||
--delete \
|
--delete \
|
||||||
--delete-excluded \
|
--delete-excluded \
|
||||||
--exclude="atomic" \
|
--exclude="atomic" \
|
||||||
@ -110,9 +118,11 @@ for REPO in $REPOS; do
|
|||||||
# TODO(pabelanger): Validate rsync process
|
# TODO(pabelanger): Validate rsync process
|
||||||
done
|
done
|
||||||
|
|
||||||
date --iso-8601=ns | $K5START tee $BASE/timestamp.txt
|
if [[ ${DRY_RUN:-0} -ne 1 ]]; then
|
||||||
echo "rsync completed successfully, running vos release."
|
date --iso-8601=ns | $K5START tee $BASE/timestamp.txt
|
||||||
vos_release $MIRROR_VOLUME
|
echo "rsync completed successfully, running vos release."
|
||||||
|
vos_release $MIRROR_VOLUME
|
||||||
|
fi
|
||||||
|
|
||||||
date --iso-8601=ns
|
date --iso-8601=ns
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user