Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AWS proxy extension not starting because of stale imports #85

Merged
merged 5 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aws-replicator/aws_replicator/client/auth_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attempting to run this from this branch directly doesn't work because it also needs this line to be set to the branch, so in order for Audacy's issue to be fixed, we need a release for this.


CONTAINER_NAME_PREFIX = "ls-aws-proxy-"
CONTAINER_CONFIG_FILE = "/tmp/ls.aws.proxy.yml"
Expand Down
16 changes: 8 additions & 8 deletions aws-replicator/aws_replicator/client/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
from aws_replicator.shared.models import ProxyConfig, ProxyServiceConfig

try:
from localstack.pro.core.bootstrap.auth import get_auth_headers
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
Expand All @@ -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
Expand Down
Loading