Skip to content

Commit 6fed50e

Browse files
committed
Cache module content
1 parent 0422f6c commit 6fed50e

File tree

1 file changed

+9
-1
lines changed
  • awscli/customizations/cloudformation/modules

1 file changed

+9
-1
lines changed

awscli/customizations/cloudformation/modules/read.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
PACKAGES,
2929
)
3030

31+
content_cache = {}
32+
3133

3234
def is_url(p):
3335
"Returns true if the path looks like a URL instead of a local file"
@@ -194,7 +196,11 @@ def read_source(source, s3_client=None):
194196

195197
dotzip = ".zip"
196198

197-
if is_s3_url(source):
199+
content = None
200+
201+
if source in content_cache:
202+
content = content_cache[source]
203+
elif is_s3_url(source):
198204
# Handle S3 URLs
199205
content = _handle_s3_source(source, s3_client, dotzip)
200206
elif is_url(source):
@@ -204,6 +210,8 @@ def read_source(source, s3_client=None):
204210
# Handle local files
205211
content = _handle_local_source(source, dotzip)
206212

213+
content_cache[source] = content
214+
207215
node = yamlhelper.yaml_compose(content)
208216
lines = {}
209217
read_line_numbers(node, lines)

0 commit comments

Comments
 (0)