Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove deprecated config USE_SINGLE_REGION #9374

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

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 1 addition & 4 deletions localstack/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,6 @@ def in_docker():
# Whether to report internal failures as 500 or 501 errors.
FAIL_FAST = is_env_true("FAIL_FAST")

# whether to use the legacy single-region mode, defined via DEFAULT_REGION (DEPRECATED!)
USE_SINGLE_REGION = is_env_true("USE_SINGLE_REGION")

# whether to run in TF compatibility mode for TF integration tests
# (e.g., returning verbatim ports for ELB resources, rather than edge port 4566, etc.)
TF_COMPAT_MODE = is_env_true("TF_COMPAT_MODE")
Expand Down Expand Up @@ -1283,7 +1280,7 @@ def use_custom_dns():
"SYNCHRONOUS_SNS_EVENTS",
"TEST_AWS_ACCOUNT_ID",
"TF_COMPAT_MODE",
"USE_SINGLE_REGION",
"USE_SINGLE_REGION", # Not functional; deprecated in 0.12.7, removed in 3.0.0
"USE_SSL",
"WAIT_FOR_DEBUGGER",
"WINDOWS_DOCKER_MOUNT_PREFIX",
Expand Down
4 changes: 2 additions & 2 deletions localstack/deprecations.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ def is_affected(self) -> bool:
"0.12.8",
"PORT_WEB_UI has been removed, and is not available anymore. Please remove this environment variable.",
),
# Since 0.12.7 - Full multi-region support
# Deprecated in 0.12.7, removed in 3.0.0
EnvVarDeprecation(
"USE_SINGLE_REGION",
"0.12.7",
"LocalStack now has full multi-region support. Please remove this environment variable.",
"LocalStack now has full multi-region support. This option has no effect. Please remove it from your configuration.", # noqa
),
EnvVarDeprecation(
"DEFAULT_REGION",
Expand Down
2 changes: 1 addition & 1 deletion localstack/runtime/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"REQUIRE_PRO",
"SKIP_INFRA_DOWNLOADS",
"SQS_ENDPOINT_STRATEGY",
"USE_SINGLE_REGION",
"USE_SINGLE_REGION", # Not functional; deprecated in 0.12.7, removed in 3.0.0
"USE_SSL",
]

Expand Down
3 changes: 0 additions & 3 deletions localstack/services/edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
from localstack.utils.aws.aws_stack import (
extract_access_key_id_from_auth_header,
is_internal_call_context,
set_default_region_in_headers,
)
from localstack.utils.collections import split_list_by
from localstack.utils.functions import empty_context_manager
Expand Down Expand Up @@ -125,8 +124,6 @@ def forward_request(self, method, path, data, headers):
if api:
port = get_service_port_for_account(api, headers)

set_default_region_in_headers(headers)

should_log_trace = is_trace_logging_enabled(headers)
if api and should_log_trace:
# print request trace for debugging, if enabled
Expand Down
18 changes: 0 additions & 18 deletions localstack/utils/aws/aws_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,24 +200,6 @@ def get_s3_hostname():
return LOCALHOST


def set_default_region_in_headers(headers, service=None, region=None):
# this should now be a no-op, as we support arbitrary regions and don't use a "default" region
# TODO: remove this function once the legacy USE_SINGLE_REGION config is removed
if not config.USE_SINGLE_REGION:
return

auth_header = headers.get("Authorization")
region = region or get_region()
if not auth_header:
if service:
headers["Authorization"] = mock_aws_request_headers(service, region_name=region)[
"Authorization"
]
return
replaced = re.sub(r"(.*Credential=[^/]+/[^/]+/)([^/])+/", r"\1%s/" % region, auth_header)
headers["Authorization"] = replaced


def fix_account_id_in_arns(response, colon_delimiter=":", existing=None, replace=None):
"""Fix the account ID in the ARNs returned in the given Flask response or string"""
existing = existing or ["123456789", "1234567890", "123456789012", get_aws_account_id()]
Expand Down
6 changes: 0 additions & 6 deletions localstack/utils/aws/request_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ def __exit__(self, type, value, traceback):
def get_region_from_request_context():
"""look up region from request context"""

if config.USE_SINGLE_REGION:
return

request_context = get_request_context()
if not request_context:
return
Expand Down Expand Up @@ -197,9 +194,6 @@ def convert_to_flask_response_call(fn, *args, **kwargs):
# TODO: publish analytics event ...
return requests_to_flask_response(response)

if config.USE_SINGLE_REGION:
return

# make sure that we inherit THREAD_LOCAL request contexts to spawned sub-threads
@patch(FuncThread.__init__)
def thread_init(fn, self, *args, **kwargs):
Expand Down