From 279b3942b4b96c9129ecd4546256678db8d1ae0a Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 27 Feb 2024 11:28:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20(#3991)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ backend/app/service/app_install.go | 2 +- backend/utils/docker/docker.go | 12 ++++++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 96976303e..5894c99b9 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,8 @@ frontend/auto-imports.d.ts frontend/components.d.ts frontend/src/xpack backend/xpack +backend/router/entry_xpack.go +backend/server/init_xpack.go .history/ dist/ diff --git a/backend/app/service/app_install.go b/backend/app/service/app_install.go index 36d9f0ce0..6d7328579 100644 --- a/backend/app/service/app_install.go +++ b/backend/app/service/app_install.go @@ -701,7 +701,7 @@ func (a *AppInstallService) GetParams(id uint) (*response.AppConfig, error) { } func syncAppInstallStatus(appInstall *model.AppInstall) error { - if appInstall.Status == constant.Installing || appInstall.Status == constant.Rebuilding { + if appInstall.Status == constant.Installing || appInstall.Status == constant.Rebuilding || appInstall.Status == constant.Upgrading { return nil } containerNames, err := getContainerNames(*appInstall) diff --git a/backend/utils/docker/docker.go b/backend/utils/docker/docker.go index 260fe5d6a..03d52936c 100644 --- a/backend/utils/docker/docker.go +++ b/backend/utils/docker/docker.go @@ -48,12 +48,15 @@ func NewDockerClient() (*client.Client, error) { func (c Client) ListContainersByName(names []string) ([]types.Container, error) { var ( - options container.ListOptions + options container.ListOptions + namesMap = make(map[string]bool) + res []types.Container ) options.All = true if len(names) > 0 { var array []filters.KeyValuePair for _, n := range names { + namesMap["/"+n] = true array = append(array, filters.Arg("name", n)) } options.Filters = filters.NewArgs(array...) @@ -62,7 +65,12 @@ func (c Client) ListContainersByName(names []string) ([]types.Container, error) if err != nil { return nil, err } - return containers, nil + for _, con := range containers { + if _, ok := namesMap[con.Names[0]]; ok { + res = append(res, con) + } + } + return res, nil } func (c Client) CreateNetwork(name string) error {