Skip to content

Commit 4f38c2f

Browse files
committed
Quadlet - fix pod name to depend on the name of the generate service
Signed-off-by: Ygal Blum <[email protected]>
1 parent 0ed3df8 commit 4f38c2f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pkg/systemd/quadlet/quadlet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,7 @@ func GetPodResourceName(podUnit *parser.UnitFile) string {
14821482
// Derive pod name from unit name (with added prefix), or use user-provided name.
14831483
podName, ok := podUnit.Lookup(PodGroup, KeyPodName)
14841484
if !ok || len(podName) == 0 {
1485-
podName = removeExtension(podUnit.Filename, "systemd-", "")
1485+
podName = "systemd-%N"
14861486
}
14871487
return podName
14881488
}

test/e2e/quadlet/basic.pod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
## assert-key-is Unit RequiresMountsFor "%t/containers"
22
## assert-key-is Service Type forking
33
## assert-key-is Service SyslogIdentifier "%N"
4-
## assert-key-is-regex Service ExecStartPre ".*/podman pod create --infra-conmon-pidfile=%t/%N.pid --exit-policy=stop --replace --infra-name systemd-basic-infra --name systemd-basic"
5-
## assert-key-is-regex Service ExecStart ".*/podman pod start systemd-basic"
6-
## assert-key-is-regex Service ExecStop ".*/podman pod stop --ignore --time=10 systemd-basic"
7-
## assert-key-is-regex Service ExecStopPost ".*/podman pod rm --ignore --force systemd-basic"
4+
## assert-key-is-regex Service ExecStartPre ".*/podman pod create --infra-conmon-pidfile=%t/%N.pid --exit-policy=stop --replace --infra-name systemd-%N-infra --name systemd-%N"
5+
## assert-key-is-regex Service ExecStart ".*/podman pod start systemd-%N"
6+
## assert-key-is-regex Service ExecStop ".*/podman pod stop --ignore --time=10 systemd-%N"
7+
## assert-key-is-regex Service ExecStopPost ".*/podman pod rm --ignore --force systemd-%N"
88

99
[Pod]

0 commit comments

Comments
 (0)