Skip to content

Commit aec9f54

Browse files
committed
check model plugin is successfully loaded and store version
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 232197d commit aec9f54

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/compose/model.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ type modelAPI struct {
7575
env []string
7676
prepare func(ctx context.Context, cmd *exec.Cmd) error
7777
cleanup func()
78+
version string
7879
}
7980

8081
func (s *composeService) newModelAPI(project *types.Project) (*modelAPI, error) {
@@ -85,12 +86,16 @@ func (s *composeService) newModelAPI(project *types.Project) (*modelAPI, error)
8586
}
8687
return nil, err
8788
}
89+
if dockerModel.Err != nil {
90+
return nil, fmt.Errorf("failed to load Docker Model plugin: %w", dockerModel.Err)
91+
}
8892
endpoint, cleanup, err := s.propagateDockerEndpoint()
8993
if err != nil {
9094
return nil, err
9195
}
9296
return &modelAPI{
93-
path: dockerModel.Path,
97+
path: dockerModel.Path,
98+
version: dockerModel.Version,
9499
prepare: func(ctx context.Context, cmd *exec.Cmd) error {
95100
return s.prepareShellOut(ctx, project.Environment, cmd)
96101
},

0 commit comments

Comments
 (0)