Quadlet: exit 0 when there are no files to process

Quadlet should not exit with failure if no files to process have been
found.  Otherwise, even simple operations such as reloading systemd
will fail as it retriggers generators.

Fixes: #17374
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2023-02-07 10:48:31 +01:00
parent dcbe0182a9
commit f1352521ff
2 changed files with 4 additions and 2 deletions

View File

@ -327,8 +327,10 @@ func main() {
}
if len(units) == 0 {
// containers/podman/issues/17374: exit cleanly but log that we
// had nothing to do
Debugf("No files to parse from %s", sourcePaths)
os.Exit(1)
os.Exit(0)
}
if !dryRun {

View File

@ -365,7 +365,7 @@ var _ = Describe("quadlet system generator", func() {
session := podmanTest.Quadlet([]string{"-dryrun"}, "/something")
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(1))
Expect(session).Should(Exit(0))
current := session.ErrorToStringArray()
expected := "No files to parse from [/something]"