* Fix #3906 - Require minimum compose version. * Fix typo in message text.
This commit is contained in:
parent
a28b23db86
commit
b5820c7398
1 changed files with 8 additions and 0 deletions
|
@ -404,12 +404,15 @@ actions:
|
||||||
|
|
||||||
HAS_COMPOSE = True
|
HAS_COMPOSE = True
|
||||||
HAS_COMPOSE_EXC = None
|
HAS_COMPOSE_EXC = None
|
||||||
|
MINIMUM_COMPOSE_VERSION = '1.7.0'
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
from ansible.module_utils.basic import *
|
from ansible.module_utils.basic import *
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
from compose import __version__ as compose_version
|
||||||
from compose.cli.command import project_from_options
|
from compose.cli.command import project_from_options
|
||||||
from compose.service import ConvergenceStrategy
|
from compose.service import ConvergenceStrategy
|
||||||
from compose.cli.main import convergence_strategy_from_opts, build_action_from_opts, image_type_from_opt
|
from compose.cli.main import convergence_strategy_from_opts, build_action_from_opts, image_type_from_opt
|
||||||
|
@ -474,6 +477,11 @@ class ContainerManager(DockerBaseClass):
|
||||||
if self.files:
|
if self.files:
|
||||||
self.options[u'--file'] = self.files
|
self.options[u'--file'] = self.files
|
||||||
|
|
||||||
|
if LooseVersion(compose_version) < LooseVersion(MINIMUM_COMPOSE_VERSION):
|
||||||
|
self.client.fail("Found docker-compose version %s. Minimum required version is %s. "
|
||||||
|
"Upgrade docker-compose to a min version of %s." %
|
||||||
|
(compose_version, MINIMUM_COMPOSE_VERSION, MINIMUM_COMPOSE_VERSION))
|
||||||
|
|
||||||
if not HAS_COMPOSE:
|
if not HAS_COMPOSE:
|
||||||
self.client.fail("Unable to load docker-compose. Try `pip install docker-compose`. Error: %s" % HAS_COMPOSE_EXC)
|
self.client.fail("Unable to load docker-compose. Try `pip install docker-compose`. Error: %s" % HAS_COMPOSE_EXC)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue