Skip to content

Commit 8467298

Browse files
committed
Format + fixed json dumps
1 parent 5d180e6 commit 8467298

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

localstack-core/localstack/aws/handlers/custom.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import logging
22

3-
from localstack.http import Response
43
from localstack import config
4+
from localstack.http import Response
55

66
from ..api import RequestContext
77
from ..chain import Handler, HandlerChain
@@ -23,11 +23,14 @@ class AccountRegionCollector(Handler):
2323
"""
2424

2525
def __call__(self, chain: HandlerChain, context: RequestContext, response: Response):
26-
2726
if context.account_id == config.INTERNAL_RESOURCE_ACCOUNT:
2827
return
29-
30-
if context.service and context.service.service_name == 'cloudwatch' and context.operation is None:
31-
return
32-
28+
29+
if (
30+
context.service
31+
and context.service.service_name == "cloudwatch"
32+
and context.operation is None
33+
):
34+
return
35+
3336
AccountRegionTracker.track(context.account_id, context.region)

localstack-core/localstack/services/cloudcontrol/provider.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
get_resource_type,
2929
resolve_json_pointer,
3030
)
31+
from localstack.utils.json import CustomEncoder
3132

3233
LOG = logging.getLogger(__name__)
3334

@@ -187,7 +188,7 @@ def list_resources(
187188
Identifier=extract_physical_resource_id_from_model_with_schema(
188189
props, type_name, provider.SCHEMA
189190
),
190-
Properties=json.dumps(props),
191+
Properties=json.dumps(props, cls=CustomEncoder),
191192
)
192193
for props in event.resource_models
193194
],

localstack-core/localstack/services/iam/resource_providers/aws_iam_policy.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ def read(
9292
"""
9393
raise NotImplementedError
9494

95-
9695
def delete(
9796
self,
9897
request: ResourceRequest[IAMPolicyProperties],

localstack-core/localstack/services/internal.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,15 @@ class AccountsRegionUsageResource:
186186

187187
def on_get(self, request):
188188
from localstack.aws.handlers.custom import AccountRegionTracker
189+
189190
output_dict = {}
190191

191-
# Iterate over the set and populate the dictionary
192+
# Iterate over the set and populate the dictionary
192193
for x, y in AccountRegionTracker.tracked:
193194
if x not in output_dict:
194-
output_dict[x] = []
195-
output_dict[x].append(y)
196-
195+
output_dict[x] = []
196+
output_dict[x].append(y)
197+
197198
return output_dict
198199

199200

0 commit comments

Comments
 (0)