Skip to content

Commit

Permalink
Merge pull request #1955 from kyleknap/codedeploy
Browse files Browse the repository at this point in the history
Remove the quotes returned by s3 in codedeploy push command
  • Loading branch information
kyleknap committed May 5, 2016
2 parents 9bdc1ab + 957a6ff commit 020f6e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion awscli/customizations/codedeploy/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def _push(self, params):
) as bundle:
try:
upload_response = self._upload_to_s3(params, bundle)
params.eTag = upload_response['ETag']
params.eTag = upload_response['ETag'].replace('"', "")
if 'VersionId' in upload_response:
params.version = upload_response['VersionId']
except Exception as e:
Expand Down
12 changes: 11 additions & 1 deletion tests/unit/customizations/codedeploy/test_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,16 @@ def test_push_throws_on_upload_to_s3_error(self):
with self.assertRaises(RuntimeError):
self.push._push(self.args)

def test_push_strips_quotes_from_etag(self):
self.args.bucket = self.bucket
self.args.key = self.key
self.push._compress = MagicMock(return_value=self.bundle_mock)
self.push._upload_to_s3 = MagicMock(return_value=self.upload_response)
self.push._register_revision = MagicMock()
self.push._push(self.args)
self.push._register_revision.assert_called_with(self.args)
self.assertEquals(str(self.args.eTag), self.upload_response['ETag'].replace('"',""))

@patch('sys.stdout', new_callable=StringIO)
def test_push_output_message(self, stdout_mock):
self.args.bucket = self.bucket
Expand All @@ -169,7 +179,7 @@ def test_push_output_message(self, stdout_mock):
'bundleType=zip,eTag={2},version={3}'.format(
self.bucket,
self.key,
self.eTag,
self.eTag.replace('"',""),
self.version_id)
)
expected_output = (
Expand Down

0 comments on commit 020f6e2

Please sign in to comment.