@@ -17,6 +17,7 @@ import (
17
17
"github.com/docker/go-units"
18
18
"github.com/pkg/errors"
19
19
20
+ "gitlab.com/postgres-ai/database-lab/v3/internal/provision/pool"
20
21
"gitlab.com/postgres-ai/database-lab/v3/internal/retrieval/engine/postgres/tools"
21
22
"gitlab.com/postgres-ai/database-lab/v3/internal/retrieval/options"
22
23
"gitlab.com/postgres-ai/database-lab/v3/pkg/log"
@@ -63,7 +64,7 @@ const (
63
64
// TODO(akartasov): Control container manager.
64
65
65
66
// StopControlContainers stops control containers run by Database Lab Engine.
66
- func StopControlContainers (ctx context.Context , dockerClient * client.Client , instanceID , dataDir string ) error {
67
+ func StopControlContainers (ctx context.Context , dockerClient * client.Client , instanceID string , fsm pool. FSManager ) error {
67
68
log .Msg ("Stop control containers" )
68
69
69
70
list , err := getContainerList (ctx , dockerClient , instanceID , getControlContainerFilters ())
@@ -80,10 +81,10 @@ func StopControlContainers(ctx context.Context, dockerClient *client.Client, ins
80
81
continue
81
82
}
82
83
83
- if shouldStopInternalProcess (controlLabel ) {
84
+ if shouldStopInternalProcess (controlLabel ) && fsm != nil {
84
85
log .Msg ("Stopping control container: " , containerName )
85
86
86
- if err := tools .StopPostgres (ctx , dockerClient , controlCont .ID , dataDir , tools .DefaultStopTimeout ); err != nil {
87
+ if err := tools .StopPostgres (ctx , dockerClient , controlCont .ID , fsm . Pool (). DataDir () , tools .DefaultStopTimeout ); err != nil {
87
88
log .Msg ("Failed to stop Postgres" , err )
88
89
tools .PrintContainerLogs (ctx , dockerClient , controlCont .ID )
89
90
0 commit comments