diff options
| author | Matt Crees <mattc@stackhpc.com> | 2025-01-20 16:50:14 +0000 |
|---|---|---|
| committer | Michal Nasiadka <mnasiadka@gmail.com> | 2025-03-24 13:43:08 +0000 |
| commit | 8421d1047ff40769d3f46abf4d3b3dae84f33023 (patch) | |
| tree | 6fece95190ff22c10f74645fccb9fbd7a1929a52 | |
| parent | a18204bcd9b7a83a757854b2f838773beea6db87 (diff) | |
| download | kolla-ansible-8421d1047ff40769d3f46abf4d3b3dae84f33023.tar.gz kolla-ansible-8421d1047ff40769d3f46abf4d3b3dae84f33023.zip | |
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
| -rw-r--r-- | ansible/roles/service-stop/tasks/main.yml | 1 | ||||
| -rw-r--r-- | kolla_ansible/cli/commands.py | 8 | ||||
| -rw-r--r-- | releasenotes/notes/kolla-ansible-stop-ignore-missing-be57276213f0a7cd.yaml | 5 |
3 files changed, 14 insertions, 0 deletions
diff --git a/ansible/roles/service-stop/tasks/main.yml b/ansible/roles/service-stop/tasks/main.yml index 54265ed41..ea502f714 100644 --- a/ansible/roles/service-stop/tasks/main.yml +++ b/ansible/roles/service-stop/tasks/main.yml @@ -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 }}" diff --git a/kolla_ansible/cli/commands.py b/kolla_ansible/cli/commands.py index bbeeece89..29c59eb09 100644 --- a/kolla_ansible/cli/commands.py +++ b/kolla_ansible/cli/commands.py @@ -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) diff --git a/releasenotes/notes/kolla-ansible-stop-ignore-missing-be57276213f0a7cd.yaml b/releasenotes/notes/kolla-ansible-stop-ignore-missing-be57276213f0a7cd.yaml new file mode 100644 index 000000000..247af74f3 --- /dev/null +++ b/releasenotes/notes/kolla-ansible-stop-ignore-missing-be57276213f0a7cd.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Adds the flag ``--ignore-missing`` to ``kolla-ansible stop`` to avoid + failing when containers are absent. |
