Fix for yaml extention does not work with override file

Signed-off-by: Eli Atzaba <eliat123@gmail.com>
This commit is contained in:
Eli Atzaba 2017-04-29 02:00:52 +03:00 committed by Joffrey F
parent 5b6637d7f8
commit 9334f29898
4 changed files with 35 additions and 3 deletions

View File

@ -128,7 +128,7 @@ SUPPORTED_FILENAMES = [
'docker-compose.yaml',
]
DEFAULT_OVERRIDE_FILENAME = 'docker-compose.override.yml'
DEFAULT_OVERRIDE_FILENAMES = ('docker-compose.override.yml', 'docker-compose.override.yaml')
log = logging.getLogger(__name__)
@ -292,8 +292,11 @@ def get_default_config_files(base_dir):
def get_default_override_file(path):
override_filename = os.path.join(path, DEFAULT_OVERRIDE_FILENAME)
return [override_filename] if os.path.exists(override_filename) else []
for default_override_filename in DEFAULT_OVERRIDE_FILENAMES:
override_filename = os.path.join(path, default_override_filename)
if os.path.exists(override_filename):
return [override_filename]
return []
def find_candidates_in_parent_dirs(filenames, path):

View File

@ -2149,3 +2149,19 @@ class CLITestCase(DockerClientTestCase):
assert 'busybox' in result.stdout
assert 'multiplecomposefiles_another_1' in result.stdout
assert 'multiplecomposefiles_simple_1' in result.stdout
def test_up_with_override_yaml(self):
self.base_dir = 'tests/fixtures/override-yaml-files'
self._project = get_project(self.base_dir, [])
self.dispatch(
[
'up', '-d',
],
None)
containers = self.project.containers()
self.assertEqual(len(containers), 2)
web, db = containers
self.assertEqual(web.human_readable_command, 'sleep 100')
self.assertEqual(db.human_readable_command, 'top')

View File

@ -0,0 +1,3 @@
db:
command: "top"

View File

@ -0,0 +1,10 @@
web:
image: busybox:latest
command: "sleep 100"
links:
- db
db:
image: busybox:latest
command: "sleep 200"