In Incident 201 we found that the Two-Factor plugin did not mirror correctly. We could not reproduce the error, but noted that had it been caused by a corrupted .zip file, we would not have caught the error. This commit corrects that by catching errors on unzipping archive files and adding the error to the failure list at the end of the log, e.g.:
==> Failed to update the following 1 plugin(s):
*** Two-Factor failed to update with message:
Zip end of central directory signature not found
This PR also adds a little more text to the logs and one more explicit rescue (which will be harder to test).
Testing
Follow the instructions in the README about dry-running the code. You may want to comment out lines 137-139 in this branch (to avoid deleting files). Do this once to get at least one .zip file downloaded
Corrupt the .zip file with something like truncate -s 50k Two-Factor-v0.9.1.zip
Comment out the line of code that downloads the .zip file (line 109 in this branch) and the line that clones the repo (or just delete your local clone)
Re-run the script and check that you get an error in the logs like the one above
In Incident 201 we found that the Two-Factor plugin did not mirror correctly. We could not reproduce the error, but noted that had it been caused by a corrupted .zip file, we would not have caught the error. This commit corrects that by catching errors on unzipping archive files and adding the error to the failure list at the end of the log, e.g.:
This PR also adds a little more text to the logs and one more explicit
rescue
(which will be harder to test).Testing
truncate -s 50k Two-Factor-v0.9.1.zip