mirror of
https://github.com/containers/podman.git
synced 2025-10-25 02:04:43 +08:00
Quadlet Kube: Add support for relative path for YAML file
If the provided path is relative, turn path to absolute Add regex verification option in tests Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
This commit is contained in:
@ -2,6 +2,7 @@ package quadlet
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
@ -617,6 +618,18 @@ func ConvertKube(kube *parser.UnitFile) (*parser.UnitFile, error) {
|
||||
return nil, fmt.Errorf("no Yaml key specified")
|
||||
}
|
||||
|
||||
if !filepath.IsAbs(yamlPath) {
|
||||
if len(kube.Path) > 0 {
|
||||
yamlPath = filepath.Join(filepath.Dir(kube.Path), yamlPath)
|
||||
} else {
|
||||
var err error
|
||||
yamlPath, err = filepath.Abs(yamlPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only allow mixed or control-group, as nothing else works well
|
||||
killMode, ok := service.Lookup(ServiceGroup, "KillMode")
|
||||
if !ok || !(killMode == "mixed" || killMode == "control-group") {
|
||||
|
||||
Reference in New Issue
Block a user