From 98738db7a55e3c3588f9a699ae275b96003efbb2 Mon Sep 17 00:00:00 2001 From: Robert Lucian Chiriac Date: Thu, 14 Nov 2024 16:21:21 +0200 Subject: [PATCH 1/5] Attempt to fix refactored imports --- aws-replicator/aws_replicator/client/cli.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/aws-replicator/aws_replicator/client/cli.py b/aws-replicator/aws_replicator/client/cli.py index d199095..c2898eb 100644 --- a/aws-replicator/aws_replicator/client/cli.py +++ b/aws-replicator/aws_replicator/client/cli.py @@ -9,22 +9,22 @@ from aws_replicator.shared.models import ProxyConfig, ProxyServiceConfig -try: - from localstack.pro.core.bootstrap.auth import get_auth_headers +try: + from localstack.pro.core.bootstrap.auth import get_platform_auth_headers from localstack.pro.core.cli.aws import aws - from localstack.pro.core.config import is_api_key_configured + from localstack.pro.core.config import is_auth_token_configured except ImportError: - # TODO remove once we don't need compatibility with <3.6 anymore - from localstack_ext.bootstrap.auth import get_auth_headers - from localstack_ext.cli.aws import aws - from localstack_ext.config import is_api_key_configured + # Only support anything over version 3.6 + from localstack.pro.core.bootstrap.auth import get_auth_headers as get_platform_auth_headers + from localstack.pro.core.cli.aws import aws + from localstack.pro.core.config import is_api_key_configured as is_auth_token_configured class AwsReplicatorPlugin(LocalstackCliPlugin): name = "aws-replicator" def should_load(self) -> bool: - return _is_logged_in() or is_api_key_configured() + return _is_logged_in() or is_auth_token_configured() def attach(self, cli: LocalstackCli) -> None: group: click.Group = cli.group @@ -37,7 +37,7 @@ def attach(self, cli: LocalstackCli) -> None: # TODO: remove over time as we're phasing out the `login` command def _is_logged_in() -> bool: try: - get_auth_headers() + get_platform_auth_headers() return True except Exception: return False From 2245b3d7dbdb501523e143e1ce0e79770973b065 Mon Sep 17 00:00:00 2001 From: Robert Lucian Chiriac Date: Thu, 14 Nov 2024 16:24:57 +0200 Subject: [PATCH 2/5] Format and lint --- aws-replicator/aws_replicator/client/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-replicator/aws_replicator/client/cli.py b/aws-replicator/aws_replicator/client/cli.py index c2898eb..6ee9748 100644 --- a/aws-replicator/aws_replicator/client/cli.py +++ b/aws-replicator/aws_replicator/client/cli.py @@ -9,7 +9,7 @@ from aws_replicator.shared.models import ProxyConfig, ProxyServiceConfig -try: +try: from localstack.pro.core.bootstrap.auth import get_platform_auth_headers from localstack.pro.core.cli.aws import aws from localstack.pro.core.config import is_auth_token_configured From 7f5dbc9a013fa9297267bbb58da094d25db04237 Mon Sep 17 00:00:00 2001 From: Robert Lucian Chiriac Date: Thu, 14 Nov 2024 17:33:47 +0200 Subject: [PATCH 3/5] Temporarily change pip package --- aws-replicator/aws_replicator/client/auth_proxy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aws-replicator/aws_replicator/client/auth_proxy.py b/aws-replicator/aws_replicator/client/auth_proxy.py index ecd8afb..008d378 100644 --- a/aws-replicator/aws_replicator/client/auth_proxy.py +++ b/aws-replicator/aws_replicator/client/auth_proxy.py @@ -55,9 +55,9 @@ LOG.setLevel(logging.DEBUG) # TODO make configurable -CLI_PIP_PACKAGE = "localstack-extension-aws-replicator" +# CLI_PIP_PACKAGE = "localstack-extension-aws-replicator" # note: enable the line below temporarily for testing: -# CLI_PIP_PACKAGE = "git+https://github.com/localstack/localstack-extensions/@branch#egg=localstack-extension-aws-replicator&subdirectory=aws-replicator" +CLI_PIP_PACKAGE = "git+https://github.com/localstack/localstack-extensions/@fix/aws-proxy-extension#egg=localstack-extension-aws-replicator&subdirectory=aws-replicator" CONTAINER_NAME_PREFIX = "ls-aws-proxy-" CONTAINER_CONFIG_FILE = "/tmp/ls.aws.proxy.yml" From ff5607de9e07a98c0c0bfc16390df3c3d91975ba Mon Sep 17 00:00:00 2001 From: Robert Lucian Chiriac Date: Thu, 14 Nov 2024 17:56:07 +0200 Subject: [PATCH 4/5] Revert "Temporarily change pip package" This reverts commit 7f5dbc9a013fa9297267bbb58da094d25db04237. --- aws-replicator/aws_replicator/client/auth_proxy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aws-replicator/aws_replicator/client/auth_proxy.py b/aws-replicator/aws_replicator/client/auth_proxy.py index 008d378..ecd8afb 100644 --- a/aws-replicator/aws_replicator/client/auth_proxy.py +++ b/aws-replicator/aws_replicator/client/auth_proxy.py @@ -55,9 +55,9 @@ LOG.setLevel(logging.DEBUG) # TODO make configurable -# CLI_PIP_PACKAGE = "localstack-extension-aws-replicator" +CLI_PIP_PACKAGE = "localstack-extension-aws-replicator" # note: enable the line below temporarily for testing: -CLI_PIP_PACKAGE = "git+https://github.com/localstack/localstack-extensions/@fix/aws-proxy-extension#egg=localstack-extension-aws-replicator&subdirectory=aws-replicator" +# CLI_PIP_PACKAGE = "git+https://github.com/localstack/localstack-extensions/@branch#egg=localstack-extension-aws-replicator&subdirectory=aws-replicator" CONTAINER_NAME_PREFIX = "ls-aws-proxy-" CONTAINER_CONFIG_FILE = "/tmp/ls.aws.proxy.yml" From d9ee0ece5fc4bf5ad95dcf3f9076d1029346e924 Mon Sep 17 00:00:00 2001 From: Robert Lucian Chiriac Date: Thu, 14 Nov 2024 18:01:40 +0200 Subject: [PATCH 5/5] Create 0.1.21 release --- aws-replicator/README.md | 1 + aws-replicator/setup.cfg | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/aws-replicator/README.md b/aws-replicator/README.md index 839ae67..8781367 100644 --- a/aws-replicator/README.md +++ b/aws-replicator/README.md @@ -126,6 +126,7 @@ If you wish to access the deprecated instructions, they can be found [here](http ## Change Log +* `0.1.21`: Fix auth-related imports that prevent the AWS proxy from starting * `0.1.20`: Fix logic for proxying S3 requests with `*.s3.amazonaws.com` host header * `0.1.19`: Print human-readable message for invalid regexes in resource configs; fix logic for proxying S3 requests with host-based addressing * `0.1.18`: Update environment check to use SDK Docker client and enable starting the proxy from within Docker (e.g., from the LS main container as part of an init script) diff --git a/aws-replicator/setup.cfg b/aws-replicator/setup.cfg index c371e87..9f6e14b 100644 --- a/aws-replicator/setup.cfg +++ b/aws-replicator/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = localstack-extension-aws-replicator -version = 0.1.20 +version = 0.1.21 summary = LocalStack AWS Proxy Extension description = Proxy AWS resources into your LocalStack instance long_description = file: README.md