mirror of https://github.com/docker/compose.git
Fix for yaml extention does not work with override file
Signed-off-by: Eli Atzaba <eliat123@gmail.com>
This commit is contained in:
parent
5b6637d7f8
commit
9334f29898
|
@ -128,7 +128,7 @@ SUPPORTED_FILENAMES = [
|
||||||
'docker-compose.yaml',
|
'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__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -292,8 +292,11 @@ def get_default_config_files(base_dir):
|
||||||
|
|
||||||
|
|
||||||
def get_default_override_file(path):
|
def get_default_override_file(path):
|
||||||
override_filename = os.path.join(path, DEFAULT_OVERRIDE_FILENAME)
|
for default_override_filename in DEFAULT_OVERRIDE_FILENAMES:
|
||||||
return [override_filename] if os.path.exists(override_filename) else []
|
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):
|
def find_candidates_in_parent_dirs(filenames, path):
|
||||||
|
|
|
@ -2149,3 +2149,19 @@ class CLITestCase(DockerClientTestCase):
|
||||||
assert 'busybox' in result.stdout
|
assert 'busybox' in result.stdout
|
||||||
assert 'multiplecomposefiles_another_1' in result.stdout
|
assert 'multiplecomposefiles_another_1' in result.stdout
|
||||||
assert 'multiplecomposefiles_simple_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')
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
db:
|
||||||
|
command: "top"
|
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
web:
|
||||||
|
image: busybox:latest
|
||||||
|
command: "sleep 100"
|
||||||
|
links:
|
||||||
|
- db
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: busybox:latest
|
||||||
|
command: "sleep 200"
|
Loading…
Reference in New Issue