From a3f9c21228fccc90850dcdd8dfe046cad761df61 Mon Sep 17 00:00:00 2001 From: Jonas Geiler Date: Mon, 10 Mar 2025 22:18:45 +0100 Subject: [PATCH] fix(docker_compose_v2): use correct flag for `assume_yes` (#1054) * fix: use correct flag for `assume_yes` The correct flag is `--y`, not `--yes`. * refactor(docker_compose_v2): use `-y` instead of `--y` to ensure future compatibility Maybe they'll change it back to `--yes` sometime, so I'll use the short form that most likely won't change. * docs(docker_compose_v2): add note about `-y` flag Co-authored-by: Felix Fontein * chore: add changelog fragment --------- Co-authored-by: Felix Fontein --- .../fragments/1054-use-correct-flag-for-assume-yes.yaml | 2 ++ plugins/modules/docker_compose_v2.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/1054-use-correct-flag-for-assume-yes.yaml diff --git a/changelogs/fragments/1054-use-correct-flag-for-assume-yes.yaml b/changelogs/fragments/1054-use-correct-flag-for-assume-yes.yaml new file mode 100644 index 00000000..d7423e61 --- /dev/null +++ b/changelogs/fragments/1054-use-correct-flag-for-assume-yes.yaml @@ -0,0 +1,2 @@ +bugfixes: + - docker_compose_v2 - rename flag for ``assume_yes`` parameter for ``docker compose up`` to ``-y`` (https://github.com/ansible-collections/community.docker/pull/1054). diff --git a/plugins/modules/docker_compose_v2.py b/plugins/modules/docker_compose_v2.py index acb1e9c3..369ff02e 100644 --- a/plugins/modules/docker_compose_v2.py +++ b/plugins/modules/docker_compose_v2.py @@ -162,7 +162,7 @@ options: version_added: 3.8.0 assume_yes: description: - - When O(assume_yes=true), pass C(--yes) to assume "yes" as answer to all prompts and run non-interactively. + - When O(assume_yes=true), pass C(-y) to assume "yes" as answer to all prompts and run non-interactively. - Right now a prompt is asked whenever a non-matching volume should be re-created. O(assume_yes=false) results in the question being answered by "no", which will simply re-use the existing volume. - This option is only available on Docker Compose 2.32.0 or newer. @@ -537,7 +537,8 @@ class ServicesManager(BaseComposeManager): if dry_run: args.append('--dry-run') if self.yes: - args.append('--yes') + # Note that the long form is '--y', and not '--yes' as one would expect. Since this looks like a bug we're using the short form. + args.append('-y') args.append('--') for service in self.services: args.append(service)