Skip to content

Commit

Permalink
Add alias as a parameter to delete_collection
Browse files Browse the repository at this point in the history
  • Loading branch information
amywieliczka committed Jun 11, 2024
1 parent 843992c commit 6c23289
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions record_indexer/scripts/delete_stage_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
from ..utils import print_opensearch_error
from .. import settings

def main(collection_id):
alias = "rikolti-stg"

# get name of index currently aliased to rikolti-stg
def delete_collection(collection_id, alias):
# get name of index currently aliased to alias
url = f"{settings.ENDPOINT}/_alias/{alias}"
r = requests.get(url, auth=settings.get_auth())
r.raise_for_status()
Expand Down Expand Up @@ -43,10 +42,11 @@ def main(collection_id):
r.raise_for_status()
print(r.json())


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("collection_id", help="Registry ID of collection to delete")
args = parser.parse_args()
main(args.collection_id)
delete_collection(args.collection_id, "rikolti-stg")

sys.exit()

0 comments on commit 6c23289

Please sign in to comment.