Quadlet Kube: Set SyslogIdentifier if was not set

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
This commit is contained in:
Ygal Blum
2022-12-04 15:53:44 +02:00
parent ca6ae5ca98
commit d61618ad44
4 changed files with 26 additions and 1 deletions

View File

@ -638,6 +638,10 @@ func ConvertKube(kube *parser.UnitFile) (*parser.UnitFile, error) {
"Type", "notify", "Type", "notify",
"NotifyAccess", "all") "NotifyAccess", "all")
if !kube.HasKey(ServiceGroup, "SyslogIdentifier") {
service.Set(ServiceGroup, "SyslogIdentifier", "%N")
}
execStart := NewPodmanCmdline("kube", "play") execStart := NewPodmanCmdline("kube", "play")
execStart.add( execStart.add(

View File

@ -11,7 +11,7 @@
## assert-key-is "Service" "Type" "notify" ## assert-key-is "Service" "Type" "notify"
## assert-key-is "Service" "NotifyAccess" "all" ## assert-key-is "Service" "NotifyAccess" "all"
## assert-key-is "Service" "Environment" "PODMAN_SYSTEMD_UNIT=%n" ## assert-key-is "Service" "Environment" "PODMAN_SYSTEMD_UNIT=%n"
## assert-key-is "Service" "SyslogIdentifier" "%N"
[Kube] [Kube]
Yaml=deployment.yml Yaml=deployment.yml

View File

@ -0,0 +1,20 @@
## assert-podman-args "kube"
## assert-podman-args "play"
## assert-podman-final-args deployment.yml
## assert-podman-args "--replace"
## assert-podman-args "--service-container=true"
## assert-podman-stop-args "kube"
## assert-podman-stop-args "down"
## assert-podman-stop-final-args deployment.yml
## assert-key-is "Unit" "RequiresMountsFor" "%t/containers"
## assert-key-is "Service" "KillMode" "mixed"
## assert-key-is "Service" "Type" "notify"
## assert-key-is "Service" "NotifyAccess" "all"
## assert-key-is "Service" "Environment" "PODMAN_SYSTEMD_UNIT=%n"
## assert-key-is "Service" "SyslogIdentifier" "mytest"
[Service]
SyslogIdentifier=mytest
[Kube]
Yaml=deployment.yml

View File

@ -322,6 +322,7 @@ var _ = Describe("quadlet system generator", func() {
Entry("uid.volume", "uid.volume"), Entry("uid.volume", "uid.volume"),
Entry("Basic kube", "basic.kube"), Entry("Basic kube", "basic.kube"),
Entry("Syslog Identifier", "syslog.identifier.kube"),
) )
}) })