From 6566aacbd6e9227b5e8766d2ea6f51fb74b08cd2 Mon Sep 17 00:00:00 2001 From: Gang Li Date: Wed, 3 Apr 2024 09:13:25 +0800 Subject: [PATCH] Fix: re-index wrong usage of the type --- charon/pkgs/indexing.py | 4 ++-- tests/test_cf_reindex.py | 4 ++-- tests/test_maven_index.py | 2 +- tests/test_npm_index.py | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/charon/pkgs/indexing.py b/charon/pkgs/indexing.py index ee42a83..42faa49 100644 --- a/charon/pkgs/indexing.py +++ b/charon/pkgs/indexing.py @@ -270,8 +270,8 @@ def re_index( ): """Refresh the index.html for the specified folder in the bucket. """ - bucket_name = bucket[1] - prefix = bucket[2] + bucket_name = bucket.get("bucket") + prefix = bucket.get("prefix") s3_client = S3Client(aws_profile=aws_profile, dry_run=dry_run) real_prefix = prefix if prefix.strip() != "/" else "" s3_folder = os.path.join(real_prefix, path) diff --git a/tests/test_cf_reindex.py b/tests/test_cf_reindex.py index 42a6dba..0e986af 100644 --- a/tests/test_cf_reindex.py +++ b/tests/test_cf_reindex.py @@ -42,7 +42,7 @@ def test_cf_maven_after_reindex(self): ) re_index( - (TEST_BUCKET, TEST_BUCKET, "ga", "", "maven.repository.redhat.com"), + {"bucket": TEST_BUCKET, "prefix": "ga"}, "org/apache/httpcomponents/httpclient/", "maven" ) @@ -67,7 +67,7 @@ def test_cf_npm_after_reindex(self): ) re_index( - (TEST_BUCKET, TEST_BUCKET, "", "", "npm.registry.redhat.com"), + {"bucket": TEST_BUCKET, "prefix": ""}, "@babel/", "npm" ) diff --git a/tests/test_maven_index.py b/tests/test_maven_index.py index a137fb1..4952c5d 100644 --- a/tests/test_maven_index.py +++ b/tests/test_maven_index.py @@ -178,7 +178,7 @@ def test_re_index(self): Body="Just a test content" ) re_index( - (TEST_BUCKET, TEST_BUCKET, "", "", None), + {"bucket": TEST_BUCKET, "prefix": ""}, commons_client_root, "maven" ) indedx_obj = test_bucket.Object(COMMONS_CLIENT_INDEX) diff --git a/tests/test_npm_index.py b/tests/test_npm_index.py index 129f527..b435f76 100644 --- a/tests/test_npm_index.py +++ b/tests/test_npm_index.py @@ -223,7 +223,7 @@ def test_re_index(self): Key=test_file_path, Body="test content" ) re_index( - (TEST_BUCKET, TEST_BUCKET, prefix, "", None), + {"bucket": TEST_BUCKET, "prefix": prefix}, "@babel/", "npm" ) index_obj = test_bucket.Object(prefixed_namespace_babel_index) @@ -253,7 +253,7 @@ def test_re_index(self): Key=test_file_path, Body="test content" ) re_index( - (TEST_BUCKET, TEST_BUCKET, prefix, "", None), + {"bucket": TEST_BUCKET, "prefix": prefix}, "/", "npm" ) index_obj = test_bucket.Object(prefixed_root_index) @@ -284,7 +284,7 @@ def test_re_index(self): Key=test_file_path, Body="test content" ) re_index( - (TEST_BUCKET, TEST_BUCKET, prefix, "", None), + {"bucket": TEST_BUCKET, "prefix": prefix}, metadata_path, "npm" ) objs = list(test_bucket.objects.all())