Skip to content

Commit

Permalink
Merge pull request #21000 from rhatdan/machine
Browse files Browse the repository at this point in the history
Strip key/values of external quotes
  • Loading branch information
openshift-merge-bot[bot] authored Feb 2, 2024
2 parents a59a32d + 9d0da9d commit 7cb0c2e
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 @@ -622,7 +622,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 @@ -792,6 +792,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

1 comment on commit 7cb0c2e

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman-next COPR build failed. @containers/packit-build please check.

Please sign in to comment.