From 4826cb7a653a469bc486deab90d065be91dee513 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Wed, 29 Jul 2020 09:37:38 -0400 Subject: [PATCH] tripleo_podman_purge: try to use -f when pruning images Recent version of podman requires yes/no when pruning images, except if -f is given as an argument. Let's first try the new way, and fallback on the old method. Change-Id: Ie2a70d4ec40c2a2142b0857822edd5122b63c941 Closes-Bug: #1889418 (cherry picked from commit f9b89173307bd6e8495c757c098c3dda01f8c822) --- .../tripleo-podman/tasks/tripleo_podman_purge.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tripleo_ansible/roles/tripleo-podman/tasks/tripleo_podman_purge.yml b/tripleo_ansible/roles/tripleo-podman/tasks/tripleo_podman_purge.yml index 5668dc95d..8afd77cae 100644 --- a/tripleo_ansible/roles/tripleo-podman/tasks/tripleo_podman_purge.yml +++ b/tripleo_ansible/roles/tripleo-podman/tasks/tripleo_podman_purge.yml @@ -15,11 +15,17 @@ # under the License. -- name: Podman prune +- name: Podman image prune become: true block: + - name: Clean podman images + command: podman image prune -a -f + rescue: + # In case -f isn't available yet, we fallback to old way. + # https://bugs.launchpad.net/tripleo/+bug/1889418 - name: Clean podman images command: podman image prune -a - - name: Clean podman volumes - command: podman volume prune -f +- name: Clean podman volumes + become: true + command: podman volume prune -f