-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to revert Miro suppressions (#2692)
* first draft of unsuppression * add image unsuppression * Apply auto-formatting rules * Add pipeline 2024-08-15 (#2688) * Loop suppress miro (#2689) * suppress miro images in a loop * Apply auto-formatting rules * add dry run option * Apply auto-formatting rules --------- Co-authored-by: Buildkite on behalf of Wellcome Collection <[email protected]> * New ArchivesDigital format, transformed from CALM Material type (#2687) * new ArchivesDigital format, transformed from CALM Material type * Apply auto-formatting rules * update label to Archives - Digital * update works ingestor tests --------- Co-authored-by: Buildkite on behalf of Wellcome Collection <[email protected]> * add 2024-08-15/pipeline_config, missed in previous commit [ci skip] * Turn the EBSCO adapter schedule back on (#2690) * tidy and dry * tidy and dry * Apply auto-formatting rules * revert irrelevant change * Apply auto-formatting rules * tidy imports * clarify printing the output * Apply auto-formatting rules --------- Co-authored-by: Buildkite on behalf of Wellcome Collection <[email protected]> Co-authored-by: Robert Kenny <[email protected]> Co-authored-by: Robert Kenny <[email protected]>
- Loading branch information
1 parent
f066c6c
commit 389a758
Showing
4 changed files
with
134 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env python3 | ||
import click | ||
|
||
from miro_updates import unsuppress_image, is_valid_miro_id | ||
|
||
|
||
@click.command() | ||
@click.argument("id") | ||
@click.option( | ||
"--origin", | ||
help="URL of the image", | ||
required=True, | ||
) | ||
@click.option( | ||
"--message", | ||
help="Why the image was reinstated, a link to a Slack message, etc.", | ||
required=True, | ||
) | ||
def unsuppress_miro(id, origin, message): | ||
""" | ||
Reinstates a previously suppressed Miro image with a given ID and origin | ||
ID is a MIRO identifier | ||
origin is the URL of the image it corresponds to. | ||
Prerequisites: | ||
- You have a MIRO id you wish to reinstate. | ||
- Find the image in the Storage Service bucket | ||
- Configure the pipeline to listen to the reindexer | ||
Usage: | ||
- provide the MIRO id as --id | ||
- provide the https://s3... URL for the image as --origin | ||
- give a reason or link in --message | ||
thus: | ||
python unsuppress_miro.py --id L0099099 --origin https://s3-.../L0099099.JP2 --message "because I say so" | ||
This may fail with a message | ||
"Delivery channels are required when updating an existing Asset via PUT" | ||
This indicates that the image in question is already on DLCS (though it may be in an error state). | ||
If you are confident that it is not working, and you wish it to be, suppress it | ||
(specifically, this is in order remove it from DLCS) and try again. | ||
""" | ||
id = id.strip() | ||
if is_valid_miro_id(id): | ||
miro_id = id | ||
else: | ||
raise click.ClickException( | ||
f"{id} doesn't look like a Miro ID and isn't the identifier of a catalogue record containing a Miro ID" | ||
) | ||
|
||
unsuppress_image(miro_id=miro_id, origin=origin, message=message) | ||
|
||
|
||
if __name__ == "__main__": | ||
unsuppress_miro() |