Skip to content
This repository was archived by the owner on Jun 30, 2021. It is now read-only.

Commit 35d19dc

Browse files
author
Simon Meng
committed
Addresss comments
1 parent 1556f2a commit 35d19dc

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/s3helper.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ def get_input_artifact(event):
2828
)
2929

3030
input_artifacts = event['CodePipeline.job']['data']['inputArtifacts']
31-
_validate_input_artifacts(input_artifacts)
31+
32+
if len(input_artifacts) != 1:
33+
raise RuntimeError('You should only have one input artifact. Please check the setting for the action.')
34+
3235
artifact_to_fetch = input_artifacts[0]
36+
LOG.info('artifact_to_fetch=%s', artifact_to_fetch)
3337

3438
artifact_s3_location = artifact_to_fetch['location']['s3Location']
3539
bucket = artifact_s3_location['bucketName']
@@ -42,16 +46,6 @@ def get_input_artifact(event):
4246
return _unzip_as_string(zipped_content_as_bytes)
4347

4448

45-
def _validate_input_artifacts(input_artifacts):
46-
"""Validate the length of input artifacts list is 1.
47-
48-
Arguments:
49-
input_artifacts {dict list} -- list of input artifacts
50-
"""
51-
if len(input_artifacts) != 1:
52-
raise RuntimeError('You should only have one input artifact. Please check the setting for the action.')
53-
54-
5549
def _unzip_as_string(data):
5650
"""Unzip stream of data in bytes as string.
5751

0 commit comments

Comments
 (0)