Skip to content

Commit

Permalink
Strip key/values of external quotes
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Dec 18, 2023
1 parent c324dbb commit 9d0da9d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
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

0 comments on commit 9d0da9d

Please sign in to comment.