Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not consider failure to sync fatal #238

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion script/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
read_files_isos = '''rsync -4 --list-only $rsync_pwd_option PRODUCTISOPATH/ | grep -P 'Media1?.iso$' | grep -E 'ARCHORS' | awk '{ $1=$2=$3=$4=""; print substr($0,5); }' >> __envsub/files_iso.lst
'''

read_files_repo = '''rsync -4 --list-only $rsync_pwd_option PRODUCTREPOPATH/ | grep -P 'Media[1-3](.license)?$' | awk '{ $1=$2=$3=$4=""; print substr($0,5); } ' | grep -v IGNOREPATTERN | grep -E 'REPOORS' | grep -E 'ARCHORS' >> __envsub/files_repo.lst
read_files_repo = '''rsync -4 --list-only $rsync_pwd_option PRODUCTREPOPATH/ | { grep -P 'Media[1-3](.license)?$' || true; } | awk '{ $1=$2=$3=$4=""; print substr($0,5); } ' | grep -v IGNOREPATTERN | grep -E 'REPOORS' | grep -E 'ARCHORS' >> __envsub/files_repo.lst
'''

read_files_repo_media = '''rsync -4 $rsync_pwd_option PRODUCTREPOPATH/*Media1/media.1/media __envsub/Media1.lst'''
Expand Down
29 changes: 29 additions & 0 deletions t/test_rsync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -eo pipefail
scriptdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

errs=0

function rsync() {
[ $successful -eq 1 ] && return 0
echo "[sender] change_dir $3 (in repos) failed: No such file or directory (2)" >&2
echo "rsync error: some files/attrs were not transferred" >&2
echo "read_files.sh failed for in $dir" >&2
return 256
}
function curl() {
return 0
}
export -f rsync curl

successful=0
export successful

for dir in "$@"; do
for expected in $(seq 0 1); do
successful=$expected
out=$(bash -e "$@/read_files.sh" $dir)
[ $? -eq 0 ] || echo "FAIL $dir : $out" $((++errs))
done
done
(exit $errs)