~linaro-infrastructure/linaro-license-protection/master

Viewing all changes in revision 472.

  • Committer: Benjamin Copeland
  • Author(s): Kelley Spoon
  • Date: 2019-10-15 15:00:38 UTC
  • Revision ID: git-v1:453ce66dcac200d6124d4341ea580e044e533507
s3_purge: rewrite to use Bucket.list_versions()

The current s3_purge script uses the Bucket.list() method
to get a listing of all s3 objects to work on.  The list()
method unfortunately filters out files that have been marked
for deleted, and this creates a race condition where
s3_purge is unable to see the files in the list that it needs
to delete in a --forcedelete run.

This change uses the list_versions() method to get a list of
everything.  It groups keys by filename, and uses the first
key in the list (the lastest version of the file) to determine
when deciding what action to take.  This should allow for the
script to run slightly faster as it process the files as all
of its keys come in instead of waiting for the list() method
to complete.

This change drops the needs for the --clean-releases option
as the method for deleting files is working on the s3 object's
name and the scope of the operation should have been limited
by the --prefix option already (default 'snapshots/').

Change-Id: If30f0dd9c7a6155442ac87bf44ef2f609802bf3c
Reviewed-on: https://review.linaro.org/c/infrastructure/linaro-license-protection/+/33011
Reviewed-by: Benjamin Copeland <ben.copeland@linaro.org>

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: