Allow entrypoint to be a list or string

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
Mazz Mosley 2015-09-07 17:26:38 +01:00
parent 9da2bf3973
commit 866979c57b
2 changed files with 16 additions and 1 deletions

View File

@ -32,7 +32,7 @@
"dns_search": {"$ref": "#/definitions/string_or_list"}, "dns_search": {"$ref": "#/definitions/string_or_list"},
"dockerfile": {"type": "string"}, "dockerfile": {"type": "string"},
"domainname": {"type": "string"}, "domainname": {"type": "string"},
"entrypoint": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, "entrypoint": {"$ref": "#/definitions/string_or_list"},
"env_file": {"$ref": "#/definitions/string_or_list"}, "env_file": {"$ref": "#/definitions/string_or_list"},
"environment": { "environment": {

View File

@ -254,6 +254,21 @@ class ConfigTest(unittest.TestCase):
) )
self.assertEqual(service[0]['expose'], expose) self.assertEqual(service[0]['expose'], expose)
def test_valid_config_oneof_string_or_list(self):
entrypoint_values = [["sh"], "sh"]
for entrypoint in entrypoint_values:
service = config.load(
config.ConfigDetails(
{'web': {
'image': 'busybox',
'entrypoint': entrypoint
}},
'working_dir',
'filename.yml'
)
)
self.assertEqual(service[0]['entrypoint'], entrypoint)
class InterpolationTest(unittest.TestCase): class InterpolationTest(unittest.TestCase):
@mock.patch.dict(os.environ) @mock.patch.dict(os.environ)