docker_compose - Fix timeout defaulting behavior (#163)

* Initial commit

* Adding changelog fragment

* Updating changelog for breaking change
This commit is contained in:
Ajpantuso 2021-10-05 02:38:24 -04:00 committed by GitHub
parent 26d8aa1c80
commit 14f15c0aec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -0,0 +1,4 @@
---
breaking_changes:
- docker_compose - fixed ``timeout`` defaulting behavior so that ``stop_grace_period``, if defined in the compose
file, will be used if `timeout`` is not specified (https://github.com/ansible-collections/community.docker/pull/163).

View File

@ -163,8 +163,10 @@ options:
timeout:
description:
- Timeout in seconds for container shutdown when attached or when containers are already running.
- By default C(compose) will use a C(10s) timeout unless C(default_grace_period) is defined for a
particular service in the I(project_src).
type: int
default: 10
default: null
use_ssh_client:
description:
- Currently ignored for this module, but might suddenly be supported later on.
@ -495,14 +497,13 @@ try:
from compose.cli.command import project_from_options
from compose.service import NoSuchImageError
from compose.cli.main import convergence_strategy_from_opts, build_action_from_opts, image_type_from_opt
from compose.const import DEFAULT_TIMEOUT, LABEL_SERVICE, LABEL_PROJECT, LABEL_ONE_OFF
from compose.const import LABEL_SERVICE, LABEL_PROJECT, LABEL_ONE_OFF
HAS_COMPOSE = True
HAS_COMPOSE_EXC = None
MINIMUM_COMPOSE_VERSION = '1.7.0'
except ImportError as dummy:
HAS_COMPOSE = False
HAS_COMPOSE_EXC = traceback.format_exc()
DEFAULT_TIMEOUT = 10
from ansible.module_utils.common.text.converters import to_native
@ -1177,7 +1178,7 @@ def main():
pull=dict(type='bool', default=False),
nocache=dict(type='bool', default=False),
debug=dict(type='bool', default=False),
timeout=dict(type='int', default=DEFAULT_TIMEOUT)
timeout=dict(type='int')
)
mutually_exclusive = [