mirror of
https://github.com/containers/podman.git
synced 2026-05-24 16:40:44 -04:00
quadlet: When loading dropin files for foo@instance, also load those for foo@.
This is how systemd works for templates, and it allows us lots of flexibilities. Signed-off-by: Alexander Larsson <alexl@redhat.com>
This commit is contained in:
@@ -254,10 +254,22 @@ func loadUnitDropins(unit *parser.UnitFile, sourcePaths []string) error {
|
||||
prevError = err
|
||||
}
|
||||
|
||||
var dropinPaths = make(map[string]string)
|
||||
for _, sourcePath := range sourcePaths {
|
||||
dropinDir := path.Join(sourcePath, unit.Filename+".d")
|
||||
dropinDirs := []string{}
|
||||
|
||||
for _, sourcePath := range sourcePaths {
|
||||
dropinDirs = append(dropinDirs, path.Join(sourcePath, unit.Filename+".d"))
|
||||
}
|
||||
|
||||
// For instantiated templates, also look in the non-instanced template dropin dirs
|
||||
templateBase, templateInstance := unit.GetTemplateParts()
|
||||
if templateBase != "" && templateInstance != "" {
|
||||
for _, sourcePath := range sourcePaths {
|
||||
dropinDirs = append(dropinDirs, path.Join(sourcePath, templateBase+".d"))
|
||||
}
|
||||
}
|
||||
|
||||
var dropinPaths = make(map[string]string)
|
||||
for _, dropinDir := range dropinDirs {
|
||||
dropinFiles, err := os.ReadDir(dropinDir)
|
||||
if err != nil {
|
||||
if !errors.Is(err, os.ErrNotExist) {
|
||||
|
||||
Reference in New Issue
Block a user