From 7fcd1070b3a410f49bd59fd6b63333c23fe79a9f Mon Sep 17 00:00:00 2001 From: David Newswanger Date: Thu, 20 Jul 2023 08:31:16 -0600 Subject: [PATCH] Fix namespace logos on S3 Issue: AAH-2575 --- CHANGES/2575.bugfix | 1 + dev/oci_env_integration/actions/insights.py | 3 +++ .../oci_env_configs/insights.compose.env | 8 ++++++-- galaxy_ng/app/tasks/namespaces.py | 9 ++++++--- 4 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 CHANGES/2575.bugfix diff --git a/CHANGES/2575.bugfix b/CHANGES/2575.bugfix new file mode 100644 index 0000000000..75c0d3a623 --- /dev/null +++ b/CHANGES/2575.bugfix @@ -0,0 +1 @@ +Fix bug where namespace logos would fail to download with S3 backends. \ No newline at end of file diff --git a/dev/oci_env_integration/actions/insights.py b/dev/oci_env_integration/actions/insights.py index 53ac8b5b6a..b5e59243ed 100644 --- a/dev/oci_env_integration/actions/insights.py +++ b/dev/oci_env_integration/actions/insights.py @@ -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 } ] ) diff --git a/dev/oci_env_integration/oci_env_configs/insights.compose.env b/dev/oci_env_integration/oci_env_configs/insights.compose.env index 645d08447a..7a8d9a8ccf 100644 --- a/dev/oci_env_integration/oci_env_configs/insights.compose.env +++ b/dev/oci_env_integration/oci_env_configs/insights.compose.env @@ -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 @@ -13,4 +13,8 @@ DJANGO_SUPERUSER_PASSWORD=admin PULP_GALAXY_API_PATH_PREFIX=/api/automation-hub/ API_PORT=55001 -INSIGHTS_PROXY_PORT=38080 \ No newline at end of file +INSIGHTS_PROXY_PORT=38080 + +S3_ENDPOINT_URL=http://localhost:11651 +MINIO_CONSOLE_PORT=7812 +MINIO_PORT=11651 \ No newline at end of file diff --git a/galaxy_ng/app/tasks/namespaces.py b/galaxy_ng/app/tasks/namespaces.py index 2518ac795e..aa093d830a 100644 --- a/galaxy_ng/app/tasks/namespaces.py +++ b/galaxy_ng/app/tasks/namespaces.py @@ -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): @@ -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,