From f3c5b0f9d1f34fc94810da514ac498fd34902120 Mon Sep 17 00:00:00 2001
From: Alexander Larsson <alexl@redhat.com>
Date: Fri, 2 Dec 2022 16:13:28 +0100
Subject: [PATCH] quadlet: Drop ExecStartPre=rm %t/%N.cid

Since https://github.com/containers/podman/pull/16394 was merged
we now always delete the cid file if --replace=true was specified,
so we can avoid this extra command being launched.

[NO NEW TESTS NEEDED] Already tested in above PR.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
---
 pkg/systemd/quadlet/quadlet.go   | 5 -----
 test/e2e/quadlet/basic.container | 1 -
 2 files changed, 6 deletions(-)

diff --git a/pkg/systemd/quadlet/quadlet.go b/pkg/systemd/quadlet/quadlet.go
index 56cb1655fb..02683480b4 100644
--- a/pkg/systemd/quadlet/quadlet.go
+++ b/pkg/systemd/quadlet/quadlet.go
@@ -222,11 +222,6 @@ func ConvertContainer(container *parser.UnitFile, isUser bool) (*parser.UnitFile
 	// Need the containers filesystem mounted to start podman
 	service.Add(UnitGroup, "RequiresMountsFor", "%t/containers")
 
-	// Remove any leftover cid file before starting, just to be sure.
-	// We remove any actual pre-existing container by name with --replace=true.
-	// But --cidfile will fail if the target exists.
-	service.Add(ServiceGroup, "ExecStartPre", "-rm -f %t/%N.cid")
-
 	// If the conman exited uncleanly it may not have removed the container, so force it,
 	// -i makes it ignore non-existing files.
 	service.Add(ServiceGroup, "ExecStopPost", "-/usr/bin/podman rm -f -i --cidfile=%t/%N.cid")
diff --git a/test/e2e/quadlet/basic.container b/test/e2e/quadlet/basic.container
index 6eef693c22..143ff261e3 100644
--- a/test/e2e/quadlet/basic.container
+++ b/test/e2e/quadlet/basic.container
@@ -14,7 +14,6 @@
 ## assert-key-is "Service" "Type" "notify"
 ## assert-key-is "Service" "NotifyAccess" "all"
 ## assert-key-is "Service" "SyslogIdentifier" "%N"
-## assert-key-is "Service" "ExecStartPre" "-rm -f %t/%N.cid"
 ## assert-key-is "Service" "ExecStopPost" "-/usr/bin/podman rm -f -i --cidfile=%t/%N.cid" "-rm -f %t/%N.cid"
 ## assert-key-is "Service" "Environment" "PODMAN_SYSTEMD_UNIT=%n"