-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alexander Larsson <[email protected]>
- Loading branch information
1 parent
dc94a10
commit cd5982e
Showing
5 changed files
with
52 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## assert-podman-final-args localhost/imagename | ||
## assert-podman-args "--name=systemd-%P_%I" | ||
## assert-symlink want.service.wants/[email protected] ../[email protected] | ||
## assert-podman-args --env "FOO=bar" | ||
|
||
[Container] | ||
Image=localhost/imagename | ||
|
||
[Install] | ||
WantedBy=want.service | ||
DefaultInstance=default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[Container] | ||
Environment=FOO=bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## assert-podman-final-args localhost/changed-image | ||
## assert-podman-args "--name=systemd-%P_%I" | ||
## assert-symlink want.service.wants/[email protected] ../[email protected] | ||
## assert-podman-args --env "FOO=bar" | ||
|
||
[Container] | ||
# Will be changed by /[email protected]/10-image.conf | ||
Image=localhost/imagename | ||
|
||
[Install] | ||
WantedBy=want.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[Container] | ||
Image=localhost/changed-image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,17 @@ type quadletTestcase struct { | |
checks [][]string | ||
} | ||
|
||
// Converts "[email protected]" to "[email protected]" | ||
func getGenericTemplateFile(fileName string) (bool, string) { | ||
extension := filepath.Ext(fileName) | ||
base := strings.TrimSuffix(fileName, extension) | ||
parts := strings.SplitN(base, "@", 2) | ||
if len(parts) == 2 && len(parts[1]) > 0 { | ||
return true, parts[0] + "@" + extension | ||
} | ||
return false, "" | ||
} | ||
|
||
func loadQuadletTestcase(path string) *quadletTestcase { | ||
data, err := os.ReadFile(path) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
@@ -724,13 +735,19 @@ BOGUS=foo | |
Expect(err).ToNot(HaveOccurred()) | ||
|
||
// Also copy any extra snippets | ||
dotdDir := filepath.Join("quadlet", fileName+".d") | ||
if s, err := os.Stat(dotdDir); err == nil && s.IsDir() { | ||
dotdDirDest := filepath.Join(quadletDir, fileName+".d") | ||
err = os.Mkdir(dotdDirDest, os.ModePerm) | ||
Expect(err).ToNot(HaveOccurred()) | ||
err = CopyDirectory(dotdDir, dotdDirDest) | ||
Expect(err).ToNot(HaveOccurred()) | ||
snippetdirs := []string{fileName + ".d"} | ||
if ok, genericFileName := getGenericTemplateFile(fileName); ok { | ||
snippetdirs = append(snippetdirs, genericFileName+".d") | ||
} | ||
for _, snippetdir := range snippetdirs { | ||
dotdDir := filepath.Join("quadlet", snippetdir) | ||
if s, err := os.Stat(dotdDir); err == nil && s.IsDir() { | ||
dotdDirDest := filepath.Join(quadletDir, snippetdir) | ||
err = os.Mkdir(dotdDirDest, os.ModePerm) | ||
Expect(err).ToNot(HaveOccurred()) | ||
err = CopyDirectory(dotdDir, dotdDirDest) | ||
Expect(err).ToNot(HaveOccurred()) | ||
} | ||
} | ||
|
||
// Run quadlet to convert the file | ||
|
@@ -825,6 +842,8 @@ BOGUS=foo | |
Entry("Container - Containers Conf Modules", "containersconfmodule.container", 0, ""), | ||
Entry("merged.container", "merged.container", 0, ""), | ||
Entry("merged-override.container", "merged-override.container", 0, ""), | ||
Entry("[email protected]", "[email protected]", 0, ""), | ||
Entry("[email protected]", "[email protected]", 0, ""), | ||
|
||
Entry("basic.volume", "basic.volume", 0, ""), | ||
Entry("device-copy.volume", "device-copy.volume", 0, ""), | ||
|