diff --git a/playbooks/roles/mirror-update/files/centos-mirror-update b/playbooks/roles/mirror-update/files/centos-mirror-update index 2f11ad87ce..519017b33c 100755 --- a/playbooks/roles/mirror-update/files/centos-mirror-update +++ b/playbooks/roles/mirror-update/files/centos-mirror-update @@ -24,6 +24,14 @@ else TIMEOUT="timeout -k 2m 30m" 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" K5START="k5start -t -f /etc/centos.keytab service/centos-mirror -- $TIMEOUT" @@ -38,7 +46,7 @@ if ! [ -f $BASE/8-stream ]; then fi date --iso-8601=ns echo "Running Centos 8-stream rsync..." -$K5START rsync -rltvz \ +$K5START ${RSYNC} \ --delete \ --delete-excluded \ --exclude="isos" \ @@ -56,7 +64,7 @@ if ! [ -f $BASE/8 ]; then fi date --iso-8601=ns echo "Running Centos 8 rsync..." -$K5START rsync -rltvz \ +$K5START ${RSYNC} \ --delete \ --delete-excluded \ --exclude="isos" \ @@ -94,7 +102,7 @@ for REPO in $REPOS; do date --iso-8601=ns echo "Running rsync..." - $K5START rsync -rltvz \ + $K5START ${RSYNC} \ --delete \ --delete-excluded \ --exclude="atomic" \ @@ -110,9 +118,11 @@ for REPO in $REPOS; do # TODO(pabelanger): Validate rsync process done -date --iso-8601=ns | $K5START tee $BASE/timestamp.txt -echo "rsync completed successfully, running vos release." -vos_release $MIRROR_VOLUME +if [[ ${DRY_RUN:-0} -ne 1 ]]; then + date --iso-8601=ns | $K5START tee $BASE/timestamp.txt + echo "rsync completed successfully, running vos release." + vos_release $MIRROR_VOLUME +fi date --iso-8601=ns echo "Done."