From 1eae0becff24dda96d9ddaf00b5f94da4bc0cb45 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Wed, 28 Aug 2019 10:20:09 -0400 Subject: [PATCH] Fix idempotency on RHEL8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On RHEL8, podman is shipped by default with podman-docker which installs an alias so the operators can still use "docker" CLI, but the command will be converted to run "podman" instead: Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg We don't want to remove the rpm or create /etc/containers/nodocker so the operators have the warning and now we are moving to Podman by default. So we need to change Paunch to detect if Docker was actually running before removing docker-managed containers, instead of using 'which docker', we'll check for the actual docker socket if it exists. Co-Authored-By: Cédric Jeanneret Change-Id: I628c2fe7e962412f0d7e1c3e044d02c5a2fabd77 (cherry picked from commit 2ed3e83fdefb965ca62234a1657fc95dc6a27e99) --- paunch/builder/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/paunch/builder/base.py b/paunch/builder/base.py index 45bec7b..aeaa494 100644 --- a/paunch/builder/base.py +++ b/paunch/builder/base.py @@ -13,6 +13,7 @@ import distutils.spawn import json +import os import re import shutil import tenacity @@ -67,7 +68,8 @@ class BaseBuilder(object): # container that runs under Docker first before starting it with # Podman. The container will be removed later in THT during # upgrade_tasks. - if self.runner.cont_cmd == 'podman' and self.which('docker'): + if self.runner.cont_cmd == 'podman' and \ + os.path.exists('/var/run/docker.sock'): self.runner.stop_container(container, 'docker', quiet=True) self.log.debug("Apply action {} for container {}.".format(