Skip to content

Commit

Permalink
didn't need no-preserve
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Nov 15, 2024
1 parent 64b81ab commit a23e352
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions bin/digifeeds/upload_to_s3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ main() {

log_debug "Copying $barcode to working directory"

if ! cp -r --no-preserve=mode,ownership "$barcode_path" "$working_barcode_path"; then
if ! cp -r "$barcode_path" "$working_barcode_path"; then
log_error "Copying $barcode to working directory failed"
errors_total=$((errors_total + 1))
continue
Expand Down Expand Up @@ -233,7 +233,7 @@ main() {

log_info "Moving $barcode to processed"
log_debug "Copying ${barcode}.zip to processed"
if ! cp --no-preserve=mode,ownership "$working_barcode_path".zip "$processed_directory"/"${TIMESTAMP}"_"${barcode}".zip; then
if ! cp "$working_barcode_path".zip "$processed_directory"/"${TIMESTAMP}"_"${barcode}".zip; then
log_error "Failed to copy $barcode.zip to processed"
errors_total=$((errors_total + 1))
continue
Expand All @@ -243,16 +243,16 @@ main() {
rm "$working_barcode_path".zip

log_debug "Copying ${barcode} to processed"
if ! cp -r --no-preserve=mode,ownership "$working_barcode_path" "$processed_directory"/"${TIMESTAMP}"_"${barcode}"; then
if ! cp -r "$working_barcode_path" "$processed_directory"/"${TIMESTAMP}"_"${barcode}"; then
log_error "Failed to copy $barcode to processed"
errors_total=$((errors_total + 1))
continue
fi

log_debug "Deleting ${working_barcode_path}.zip"
rm -r "$working_barcode_path".zip
log_debug "Deleting ${barcode_path}"
log_debug "Deleting ${working_barcode_path}"
rm -r "$working_barcode_path"
log_debug "Deleting ${barcode_path}"
rm -r "$barcode_path"

files_processed_total=$((files_processed_total + 1))
done
Expand Down
10 changes: 5 additions & 5 deletions bin/digifeeds/upload_to_s3_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ teardown() {
}
@test "Fails on copying barcode folder to working directory and moves on" {
shellmock new cp
shellmock config cp 1 regex-3:"$INPUT_DIR" <<<"Error"
shellmock config cp 1 regex-2:"$INPUT_DIR" <<<"Error"
run $SUBJECT
assert_output --partial "ERROR: Copying $BARCODE_1 to working directory failed"
assert_output --partial "ERROR: Copying $BARCODE_2 to working directory failed"
Expand All @@ -190,8 +190,8 @@ teardown() {
shellmock config rclone 0 1:check regex-2:"$WORKING_DIR" regex-3:^digifeeds_bucket:
cp -r "$INPUT_DIR"/* "$WORKING_DIR"
shellmock new cp
shellmock config cp 0 regex-3:"$INPUT_DIR"
shellmock config cp 1 regex-3:.zip <<<"Error"
shellmock config cp 0 regex-2:"$INPUT_DIR"
shellmock config cp 1 regex-2:.zip <<<"Error"
run $SUBJECT
assert_output --partial "ERROR: Failed to copy ${BARCODE_1}.zip to processed"
assert_output --partial "ERROR: Failed to copy ${BARCODE_2}.zip to processed"
Expand All @@ -208,8 +208,8 @@ teardown() {
shellmock config rclone 0 1:check regex-2:"$WORKING_DIR" regex-3:^digifeeds_bucket:
cp -r "$INPUT_DIR"/* "$WORKING_DIR"
shellmock new cp
shellmock config cp 0 regex-3:"$INPUT_DIR"
shellmock config cp 0 regex-3:.zip
shellmock config cp 0 regex-2:"$INPUT_DIR"
shellmock config cp 0 regex-2:.zip
shellmock config cp 1 <<<"Error"
run $SUBJECT
assert_output --partial "ERROR: Failed to copy ${BARCODE_1} to processed"
Expand Down

0 comments on commit a23e352

Please sign in to comment.