Skip to content

Commit 7cb0c2e

Browse files
Merge pull request #21000 from rhatdan/machine
Strip key/values of external quotes
2 parents a59a32d + 9d0da9d commit 7cb0c2e

File tree

5 files changed

+11
-4
lines changed

5 files changed

+11
-4
lines changed

pkg/systemd/parser/unitfile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ func (f *UnitFile) Lookup(groupName string, key string) (string, bool) {
622622
return "", false
623623
}
624624

625-
return strings.TrimRightFunc(v, unicode.IsSpace), true
625+
return strings.Trim(strings.TrimRightFunc(v, unicode.IsSpace), "\""), true
626626
}
627627

628628
// Lookup the last instance of a key and convert the value to a bool

test/e2e/quadlet/health.container

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[Container]
22
Image=localhost/imagename
3-
## assert-podman-args "--health-cmd" "\"hello world\""
3+
## assert-podman-args "--health-cmd" "hello world"
44
HealthCmd="hello world"
55
## assert-podman-args "--health-interval" "1m"
66
HealthInterval=1m

test/e2e/quadlet/hostname.container

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[Container]
22
Image=localhost/imagename
3-
## assert-podman-args "--hostname" "\"quadlet-host\""
4-
HostName="quadlet-host"
3+
## assert-podman-args "--hostname" "quadlet-host"
4+
HostName=quadlet-host

test/e2e/quadlet/quotes.container

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## assert-podman-final-args localhost/imagename
2+
## assert-podman-args --name=RemoveQuotes\"Name
3+
4+
[Container]
5+
Image="localhost/imagename"
6+
ContainerName="RemoveQuotes"Name"

test/e2e/quadlet_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,7 @@ BOGUS=foo
792792
Entry("ports.container", "ports.container", 0, ""),
793793
Entry("ports_ipv6.container", "ports_ipv6.container", 0, ""),
794794
Entry("pull.container", "pull.container", 0, ""),
795+
Entry("quotes.container", "quotes.container", 0, ""),
795796
Entry("readonly.container", "readonly.container", 0, ""),
796797
Entry("readonly-tmpfs.container", "readonly-tmpfs.container", 0, ""),
797798
Entry("readonly-notmpfs.container", "readonly-notmpfs.container", 0, ""),

0 commit comments

Comments
 (0)