diff options
author | Maxim Yurchuk <maxim-yurchuk@ydb.tech> | 2024-12-12 15:00:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-12 15:00:43 +0000 |
commit | 42701242eaf5be980cb935631586d0e90b82641c (patch) | |
tree | 6dbf5fcd37d3c16591e196c4a69d166e3ab3a398 /contrib/python/moto/py3/patches/01-arcadia.patch | |
parent | 7f5a9f394dbd9ac290cabbb7977538656b3a541e (diff) | |
parent | f7c04b5876af3d16849ab5e3079c0eabbd4e3a00 (diff) | |
download | ydb-42701242eaf5be980cb935631586d0e90b82641c.tar.gz |
Merge pull request #12554 from vitalyisaev2/YQ-3839.with_rightlib.3
Import from Arcadia + YDB FQ: turning gateways_config.proto into a file without external dependencies
Diffstat (limited to 'contrib/python/moto/py3/patches/01-arcadia.patch')
-rw-r--r-- | contrib/python/moto/py3/patches/01-arcadia.patch | 65 |
1 files changed, 40 insertions, 25 deletions
diff --git a/contrib/python/moto/py3/patches/01-arcadia.patch b/contrib/python/moto/py3/patches/01-arcadia.patch index 4caffd314b..89fbdcc9a5 100644 --- a/contrib/python/moto/py3/patches/01-arcadia.patch +++ b/contrib/python/moto/py3/patches/01-arcadia.patch @@ -1,6 +1,6 @@ --- contrib/python/moto/py3/moto/cognitoidp/responses.py (index) +++ contrib/python/moto/py3/moto/cognitoidp/responses.py (working tree) -@@ -624,10 +624,8 @@ class CognitoIdpResponse(BaseResponse): +@@ -615,10 +615,8 @@ class CognitoIdpResponse(BaseResponse): class CognitoIdpJsonWebKeyResponse(BaseResponse): def __init__(self): @@ -13,27 +13,31 @@ def serve_json_web_key( self, request, full_url, headers ---- contrib/python/moto/py3/moto/s3/responses.py (index) -+++ contrib/python/moto/py3/moto/s3/responses.py (working tree) -@@ -288,6 +288,8 @@ class ResponseObject(_TemplateEnvironmentMixin, ActionAuthenticatorMixin): - request.headers.get("Authorization", "") - ) - region_name = region_name or DEFAULT_REGION_NAME -+ if region_name == "yandex": -+ region_name = DEFAULT_REGION_NAME - - bucket_name = self.parse_bucket_name_from_url(request, full_url) - if not bucket_name: --- contrib/python/moto/py3/moto/ec2/models/amis.py (index) +++ contrib/python/moto/py3/moto/ec2/models/amis.py (working tree) -@@ -25,1 +25,1 @@ if "MOTO_AMIS_PATH" in environ: +@@ -21,7 +21,7 @@ if "MOTO_AMIS_PATH" in environ: + with open(environ.get("MOTO_AMIS_PATH"), "r", encoding="utf-8") as f: + AMIS = json.load(f) + else: - AMIS = load_resource(__name__, "../resources/amis.json") + AMIS = load_resource("moto.ec2", "resources/amis.json") + + + class Ami(TaggedEC2Resource): +@@ -156,7 +156,7 @@ class AmiBackend: + self.amis[ami_id] = Ami(self, **ami) + try: + latest_amis = load_resource( +- __name__, f"../resources/latest_amis/{self.region_name}.json" ++ "moto.ec2", f"resources/latest_amis/{self.region_name}.json" + ) + for ami in latest_amis: + ami_id = ami["ami_id"] --- contrib/python/moto/py3/moto/ec2/models/instance_types.py (index) +++ contrib/python/moto/py3/moto/ec2/models/instance_types.py (working tree) -@@ -5,19 +5,27 @@ from os import listdir +@@ -6,19 +6,27 @@ from ..utils import generic_filter from moto.utilities.utils import load_resource - from ..exceptions import InvalidInstanceTypeError + from ..exceptions import InvalidFilter, InvalidInstanceTypeError -INSTANCE_TYPES = load_resource(__name__, "../resources/instance_types.json") +import library.python.resource as _ya_res @@ -48,24 +52,35 @@ +root = pathlib.Path(__file__).parent.parent +offerings_path = "resources/instance_type_offerings" INSTANCE_TYPE_OFFERINGS = {} --for location_type in listdir(root / offerings_path): -- INSTANCE_TYPE_OFFERINGS[location_type] = {} -- for _region in listdir(root / offerings_path / location_type): -- full_path = offerings_path + "/" + location_type + "/" + _region +-for _location_type in listdir(root / offerings_path): +- INSTANCE_TYPE_OFFERINGS[_location_type] = {} +- for _region in listdir(root / offerings_path / _location_type): +- full_path = offerings_path + "/" + _location_type + "/" + _region - res = load_resource(__name__, full_path) - for instance in res: -- instance["LocationType"] = location_type +- instance["LocationType"] = _location_type +for entry in _ya_res.resfs_files(prefix=str(root / offerings_path)): + rel_path = os.path.relpath(entry, root / offerings_path) + path_parts = os.path.normpath(rel_path).split(os.path.sep) + if len(path_parts) != 2: + continue -+ location_type, _region = path_parts -+ if location_type not in INSTANCE_TYPE_OFFERINGS: -+ INSTANCE_TYPE_OFFERINGS[location_type] = {} ++ _location_type, _region = path_parts ++ if _location_type not in INSTANCE_TYPE_OFFERINGS: ++ INSTANCE_TYPE_OFFERINGS[_location_type] = {} + res = json.loads(_ya_res.find(f"resfs/file/{entry}")) + for instance in res: -+ instance["LocationType"] = location_type - INSTANCE_TYPE_OFFERINGS[location_type][_region.replace(".json", "")] = res ++ instance["LocationType"] = _location_type + INSTANCE_TYPE_OFFERINGS[_location_type][_region.replace(".json", "")] = res +--- contrib/python/moto/py3/moto/s3/responses.py (index) ++++ contrib/python/moto/py3/moto/s3/responses.py (working tree) +@@ -283,6 +283,8 @@ class S3Response(BaseResponse): + request.headers.get("Authorization", "") + ) + region_name = region_name or DEFAULT_REGION_NAME ++ if region_name == "yandex": ++ region_name = DEFAULT_REGION_NAME + + bucket_name = self.parse_bucket_name_from_url(request, full_url) + if not bucket_name: |