Skip to content

Commit

Permalink
feat: add envd app exit handler (#1722)
Browse files Browse the repository at this point in the history
* feat: add envd app exit handler

Signed-off-by: Keming <kemingyang@tensorchord.ai>

* rm commented code

Signed-off-by: Keming <kemingyang@tensorchord.ai>

* fix test

Signed-off-by: Keming <kemingyang@tensorchord.ai>

---------

Signed-off-by: Keming <kemingyang@tensorchord.ai>
  • Loading branch information
kemingy committed Aug 4, 2023
1 parent ddc3009 commit f51990e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pkg/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ func New() EnvdApp {
return nil
}

internalApp.ExitErrHandler = func(context *cli.Context, err error) {
if err != nil {
logrus.Fatal(err)
}
}

return EnvdApp{
App: *internalApp,
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/driver/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ func NormalizeName(s string) (string, error) {
}
// remove the spaces
s = strings.ReplaceAll(s, " ", "")
return s, nil
name, err := reference.Parse(s)
if err != nil {
return "", errors.Wrapf(err, "failed to parse the name '%s', please provide a valid image name", s)
}
return name.String(), nil
}

func (c dockerClient) ListImage(ctx context.Context) ([]types.ImageSummary, error) {
Expand Down

0 comments on commit f51990e

Please sign in to comment.