Skip to content

Commit

Permalink
Fix namespace logos on S3
Browse files Browse the repository at this point in the history
Issue: AAH-2575
  • Loading branch information
newswangerd committed Jul 31, 2023
1 parent 0a9fab1 commit 6376fb4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES/2575.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug where namespace logos would fail to download with S3 backends.
3 changes: 3 additions & 0 deletions dev/oci_env_integration/actions/insights.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"env_file": "insights.compose.env",
"run_tests": True,
"db_restore": None,

# The minio client can take a long time to install
"wait_before_tests": 120
}
]
)
8 changes: 6 additions & 2 deletions dev/oci_env_integration/oci_env_configs/insights.compose.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
COMPOSE_PROFILE=galaxy_ng/base:galaxy_ng/insights
COMPOSE_PROFILE=galaxy_ng/base:galaxy_ng/insights:pminio
COMPOSE_PROJECT_NAME=ci-insights

DEV_SOURCE_PATH=galaxy_ng
Expand All @@ -13,4 +13,8 @@ DJANGO_SUPERUSER_PASSWORD=admin
PULP_GALAXY_API_PATH_PREFIX=/api/automation-hub/

API_PORT=55001
INSIGHTS_PROXY_PORT=38080
INSIGHTS_PROXY_PORT=38080

S3_ENDPOINT_URL=http://localhost:11651
MINIO_CONSOLE_PORT=7812
MINIO_PORT=11651
9 changes: 6 additions & 3 deletions galaxy_ng/app/tasks/namespaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ def _download_avatar(url):
print("file is not an image")
return

return Artifact.init_and_validate(tf)
# the artifact has to be saved before the file is closed, or s3transfer
# will throw an error.
artifact = Artifact.init_and_validate(tf)
artifact.save()

return artifact


def _create_pulp_namespace(galaxy_ns_pk, download_logo):
Expand Down Expand Up @@ -99,8 +104,6 @@ def _create_pulp_namespace(galaxy_ns_pk, download_logo):
else:
with transaction.atomic():
metadata.save()
if avatar_artifact:
avatar_artifact.save()
ContentArtifact.objects.create(
artifact=avatar_artifact,
content=metadata,
Expand Down

0 comments on commit 6376fb4

Please sign in to comment.