mirror of
https://github.com/containers/podman.git
synced 2025-10-16 18:53:19 +08:00
Merge pull request #26977 from jakmeier/fix-quadlet-mount-panic
quadlet: fix runtime error for invalid Mount value
This commit is contained in:
@ -1858,6 +1858,9 @@ func handleLogOpt(unitFile *parser.UnitFile, groupName string, podman *PodmanCmd
|
|||||||
}
|
}
|
||||||
|
|
||||||
func handleStorageSource(quadletUnitFile, serviceUnitFile *parser.UnitFile, source string, unitsInfoMap map[string]*UnitInfo, checkImage bool) (string, error) {
|
func handleStorageSource(quadletUnitFile, serviceUnitFile *parser.UnitFile, source string, unitsInfoMap map[string]*UnitInfo, checkImage bool) (string, error) {
|
||||||
|
if source == "" {
|
||||||
|
return "", fmt.Errorf("source cannot be empty")
|
||||||
|
}
|
||||||
if source[0] == '.' {
|
if source[0] == '.' {
|
||||||
var err error
|
var err error
|
||||||
source, err = getAbsolutePath(quadletUnitFile, source)
|
source, err = getAbsolutePath(quadletUnitFile, source)
|
||||||
|
6
test/e2e/quadlet/mount-source-missing.container
Normal file
6
test/e2e/quadlet/mount-source-missing.container
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
## assert-failed
|
||||||
|
## assert-stderr-contains "source cannot be empty"
|
||||||
|
|
||||||
|
[Container]
|
||||||
|
Image=localhost/imagename
|
||||||
|
Mount=/home:/home
|
@ -1142,6 +1142,8 @@ BOGUS=foo
|
|||||||
Entry("Build - Neither WorkingDirectory nor File Key", "neither-workingdirectory-nor-file.build", "converting \"neither-workingdirectory-nor-file.build\": neither SetWorkingDirectory, nor File key specified"),
|
Entry("Build - Neither WorkingDirectory nor File Key", "neither-workingdirectory-nor-file.build", "converting \"neither-workingdirectory-nor-file.build\": neither SetWorkingDirectory, nor File key specified"),
|
||||||
Entry("Build - No ImageTag Key", "no-imagetag.build", "converting \"no-imagetag.build\": no ImageTag key specified"),
|
Entry("Build - No ImageTag Key", "no-imagetag.build", "converting \"no-imagetag.build\": no ImageTag key specified"),
|
||||||
Entry("emptyline.container", "emptyline.container", "converting \"emptyline.container\": no Image or Rootfs key specified"),
|
Entry("emptyline.container", "emptyline.container", "converting \"emptyline.container\": no Image or Rootfs key specified"),
|
||||||
|
|
||||||
|
Entry("Mount - Missing source=...", "mount-source-missing.container", "converting \"mount-source-missing.container\": source cannot be empty"),
|
||||||
)
|
)
|
||||||
|
|
||||||
DescribeTable("Running success quadlet with ServiceName test case",
|
DescribeTable("Running success quadlet with ServiceName test case",
|
||||||
|
Reference in New Issue
Block a user