Skip to content

Commit

Permalink
Ensure output of ssmstore is the appropriate type of string (#670)
Browse files Browse the repository at this point in the history
  • Loading branch information
phobologic committed Oct 19, 2018
1 parent 825003e commit 749054c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion stacker/lookups/handlers/ssmstore.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import str

from stacker.session_cache import get_session

from ...util import read_value_from_path
Expand Down Expand Up @@ -51,7 +53,7 @@ def handler(value, **kwargs):
WithDecryption=True
)
if 'Parameters' in response:
return response['Parameters'][0]['Value']
return str(response['Parameters'][0]['Value'])

raise ValueError('SSMKey "{}" does not exist in region {}'.format(value,
region))
2 changes: 2 additions & 0 deletions stacker/tests/lookups/handlers/test_ssmstore.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import str
import unittest
import mock
from botocore.stub import Stubber
Expand Down Expand Up @@ -47,6 +48,7 @@ def test_ssmstore_handler(self, mock_client):
with self.stubber:
value = handler(self.ssmkey)
self.assertEqual(value, self.ssmvalue)
self.assertIsInstance(value, str)

@mock.patch('stacker.lookups.handlers.ssmstore.get_session',
return_value=SessionStub(client))
Expand Down

0 comments on commit 749054c

Please sign in to comment.