Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip key/values of external quotes #21000

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/systemd/parser/unitfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ func (f *UnitFile) Lookup(groupName string, key string) (string, bool) {
return "", false
}

return strings.TrimRightFunc(v, unicode.IsSpace), true
return strings.Trim(strings.TrimRightFunc(v, unicode.IsSpace), "\""), true
}

// Lookup the last instance of a key and convert the value to a bool
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/health.container
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Container]
Image=localhost/imagename
## assert-podman-args "--health-cmd" "\"hello world\""
## assert-podman-args "--health-cmd" "hello world"
HealthCmd="hello world"
## assert-podman-args "--health-interval" "1m"
HealthInterval=1m
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/quadlet/hostname.container
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[Container]
Image=localhost/imagename
## assert-podman-args "--hostname" "\"quadlet-host\""
HostName="quadlet-host"
## assert-podman-args "--hostname" "quadlet-host"
HostName=quadlet-host
6 changes: 6 additions & 0 deletions test/e2e/quadlet/quotes.container
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## assert-podman-final-args localhost/imagename
## assert-podman-args --name=RemoveQuotes\"Name

[Container]
Image="localhost/imagename"
ContainerName="RemoveQuotes"Name"
1 change: 1 addition & 0 deletions test/e2e/quadlet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ BOGUS=foo
Entry("ports.container", "ports.container", 0, ""),
Entry("ports_ipv6.container", "ports_ipv6.container", 0, ""),
Entry("pull.container", "pull.container", 0, ""),
Entry("quotes.container", "quotes.container", 0, ""),
Entry("readonly.container", "readonly.container", 0, ""),
Entry("readonly-tmpfs.container", "readonly-tmpfs.container", 0, ""),
Entry("readonly-notmpfs.container", "readonly-notmpfs.container", 0, ""),
Expand Down