Skip to content

Commit 9c090d0

Browse files
committed
fix import of pro package to be dynamic based on license activation state - also updated minor version trying to ensure changes get applied
1 parent 57ae811 commit 9c090d0

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

utils/localstack_extensions/utils/docker.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import requests
66

77
from localstack.config import is_env_true
8-
from localstack.pro.core.utils.container.registry_strategies import CustomizableRegistryStrategy
98
from localstack_extensions.utils.h2_proxy import (
109
apply_http2_patches_for_grpc_support,
1110
)
@@ -104,7 +103,21 @@ def __init__(
104103
http2_ports: list[int] | None = None,
105104
tcp_ports: list[int] | None = None,
106105
):
107-
self.image_name = CustomizableRegistryStrategy().resolve(image_name)
106+
from localstack import config as ls_config
107+
from localstack.constants import ENV_PRO_ACTIVATED
108+
109+
pro_activated = is_env_true(ENV_PRO_ACTIVATED)
110+
prefix = ls_config.DOCKER_GLOBAL_IMAGE_PREFIX
111+
112+
if pro_activated:
113+
from localstack.pro.core.utils.container.registry_strategies import CustomizableRegistryStrategy
114+
# CustomizableRegistryStrategy.resolve() has a bug: for images in `name:tag` format
115+
# (no namespace, e.g. `wiremock:3.0`), the colon in parts[0] causes it to treat the
116+
# image as a registry reference and return an invalid result. Normalise first.
117+
self.image_name = CustomizableRegistryStrategy().resolve(image_name)
118+
else:
119+
self.image_name = image_name
120+
108121
if not container_ports:
109122
raise ValueError("container_ports is required")
110123
self.container_ports = container_ports

utils/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "localstack-extensions-utils"
7-
version = "0.1.0"
7+
version = "0.1.1"
88
description = "Utility library for LocalStack Extensions"
99
readme = {file = "README.md", content-type = "text/markdown; charset=UTF-8"}
1010
requires-python = ">=3.10"

0 commit comments

Comments
 (0)