From bcd7b9bde4decb11501a8913338a21e9edf0e2cd Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Fri, 26 Jun 2020 08:30:40 +0200 Subject: [PATCH] docker_compose: dont start the service if parameter stopped is true (#547) * dont start the service it parameter stopped is true * add missing changelog fragment * fix formatting of the changelog fragment * add condition to disallow the usage of stopped and restarted at the same time * fix changelog --- plugins/modules/docker_compose.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/modules/docker_compose.py b/plugins/modules/docker_compose.py index 47faed89..f565de62 100644 --- a/plugins/modules/docker_compose.py +++ b/plugins/modules/docker_compose.py @@ -639,6 +639,9 @@ class ContainerManager(DockerBaseClass): "Upgrade docker-compose to a min version of %s." % (compose_version, MINIMUM_COMPOSE_VERSION, MINIMUM_COMPOSE_VERSION)) + if self.restarted and self.stopped: + self.client.fail("Cannot use restarted and stopped at the same time.") + self.log("options: ") self.log(self.options, pretty_print=True) @@ -767,7 +770,7 @@ class ContainerManager(DockerBaseClass): )) result['actions'].append(result_action) - if not self.check_mode and result['changed']: + if not self.check_mode and result['changed'] and not self.stopped: out_redir_name, err_redir_name = make_redirection_tempfiles() try: with stdout_redirector(out_redir_name):