Disallow booleans in environment

When users were putting true/false/yes/no in the environment key,
the YML parser was converting them into True/False, rather than leaving
them as a string.

This change will force people to put them in quotes, thus ensuring
that the value gets passed through as intended.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
Mazz Mosley 2015-09-07 16:45:58 +01:00
commit a594a2ccc2
3 changed files with 17 additions and 5 deletions

View file

@ -270,15 +270,15 @@ class ConfigTest(unittest.TestCase):
)
self.assertEqual(service[0]['entrypoint'], entrypoint)
def test_validation_message_for_invalid_type_when_multiple_types_allowed(self):
expected_error_msg = "Service 'web' configuration key 'mem_limit' contains an invalid type, it should be a number or a string"
def test_config_environment_contains_boolean_validation_error(self):
expected_error_msg = "Service 'web' configuration key 'environment' contains an invalid type"
with self.assertRaisesRegexp(ConfigurationError, expected_error_msg):
config.load(
config.ConfigDetails(
{'web': {
'image': 'busybox',
'mem_limit': ['incorrect']
'environment': {'SHOW_STUFF': True}
}},
'working_dir',
'filename.yml'