Allow ignoring missing containers in service-stop

The kolla docker/podman workers already have support for ignoring when
containers are missing. This patch just exposes that to the CLI with the
flag ``--ignore-missing``.

Change-Id: Ie74ea3ea66380063cf67f2e0edb2a0e160d89cd7
This commit is contained in:
Matt Crees 2025-01-20 16:50:14 +00:00 committed by Michal Nasiadka
parent a18204bcd9
commit 8421d1047f
3 changed files with 14 additions and 0 deletions

View File

@ -7,6 +7,7 @@
action: "stop_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
ignore_missing: "{{ kolla_action_stop_ignore_missing | bool }}"
when:
- service.container_name not in skip_stop_containers
with_dict: "{{ project_services | select_services_enabled_and_mapped_to_host }}"

View File

@ -281,6 +281,11 @@ class Stop(KollaAnsibleMixin, Command):
required=True,
help="WARNING! This action will remove the Openstack deployment!",
)
group.add_argument(
"--ignore-missing",
action="store_true",
help="Don't fail if there are missing containers"
)
return parser
def take_action(self, parsed_args):
@ -288,6 +293,9 @@ class Stop(KollaAnsibleMixin, Command):
extra_vars = {}
extra_vars["kolla_action"] = "stop"
extra_vars["kolla_action_stop_ignore_missing"] = (
"yes" if parsed_args.ignore_missing else "no"
)
playbooks = _choose_playbooks(parsed_args)

View File

@ -0,0 +1,5 @@
---
features:
- |
Adds the flag ``--ignore-missing`` to ``kolla-ansible stop`` to avoid
failing when containers are absent.