Skip to content

Commit 4120115

Browse files
Merge pull request #26193 from refi64/container-graph-errors
libpod: Don't exclude running deps from the container graph inputs
2 parents 10b8905 + 051be9b commit 4120115

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

libpod/container_internal.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ func (c *Container) startDependencies(ctx context.Context) error {
923923

924924
// Traverse the graph beginning at nodes with no dependencies
925925
for _, node := range graph.noDepNodes {
926-
startNode(ctx, node, false, ctrErrors, ctrsVisited, true)
926+
startNode(ctx, node, false, ctrErrors, ctrsVisited, false)
927927
}
928928

929929
if len(ctrErrors) > 0 {
@@ -957,18 +957,10 @@ func (c *Container) getAllDependencies(visited map[string]*Container) error {
957957
if err != nil {
958958
return err
959959
}
960-
status, err := dep.State()
961-
if err != nil {
960+
visited[depID] = dep
961+
if err := dep.getAllDependencies(visited); err != nil {
962962
return err
963963
}
964-
// if the dependency is already running, we can assume its dependencies are also running
965-
// so no need to add them to those we need to start
966-
if status != define.ContainerStateRunning {
967-
visited[depID] = dep
968-
if err := dep.getAllDependencies(visited); err != nil {
969-
return err
970-
}
971-
}
972964
}
973965
}
974966
return nil

test/e2e/run_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2269,6 +2269,19 @@ WORKDIR /madethis`, BB)
22692269
running.WaitWithDefaultTimeout()
22702270
Expect(running).Should(ExitCleanly())
22712271
Expect(running.OutputToStringArray()).To(HaveLen(2))
2272+
2273+
podmanTest.StopContainer("--all")
2274+
2275+
indirectName := "ctr3"
2276+
indirectContainer := podmanTest.Podman([]string{"create", "--name", indirectName, "--requires", mainName, ALPINE, "top"})
2277+
indirectContainer.WaitWithDefaultTimeout()
2278+
Expect(indirectContainer).Should(ExitCleanly())
2279+
2280+
for _, name := range []string{depName, indirectName} {
2281+
start := podmanTest.Podman([]string{"start", name})
2282+
start.WaitWithDefaultTimeout()
2283+
Expect(start).Should(ExitCleanly())
2284+
}
22722285
})
22732286

22742287
It("podman run with pidfile", func() {

0 commit comments

Comments
 (0)