fix: 快照恢复忽略应用恢复失败问题 (#7012)

This commit is contained in:
ssongliu 2024-11-12 17:34:23 +08:00 committed by GitHub
parent f2849aa6ec
commit 5e8b23db6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 6 additions and 16 deletions

View File

@ -634,8 +634,7 @@ func handleAlert(stdout, clamName string, clamId uint) {
lines := strings.Split(stdout, "\n") lines := strings.Split(stdout, "\n")
for _, line := range lines { for _, line := range lines {
if strings.HasPrefix(line, "Infected files: ") { if strings.HasPrefix(line, "Infected files: ") {
var infectedFiles = 0 infectedFiles, _ := strconv.Atoi(strings.TrimPrefix(line, "Infected files: "))
infectedFiles, _ = strconv.Atoi(strings.TrimPrefix(line, "Infected files: "))
if infectedFiles > 0 { if infectedFiles > 0 {
pushAlert := dto.PushAlert{ pushAlert := dto.PushAlert{
TaskName: clamName, TaskName: clamName,

View File

@ -432,7 +432,7 @@ func (u *ImageService) ImageRemove(req dto.BatchDelete) error {
} }
defer client.Close() defer client.Close()
for _, id := range req.Names { for _, id := range req.Names {
if _, err := client.ImageRemove(context.TODO(), id, types.ImageRemoveOptions{Force: req.Force, PruneChildren: true}); err != nil { if _, err := client.ImageRemove(context.TODO(), id, image.RemoveOptions{Force: req.Force, PruneChildren: true}); err != nil {
if strings.Contains(err.Error(), "image is being used") || strings.Contains(err.Error(), "is using") { if strings.Contains(err.Error(), "image is being used") || strings.Contains(err.Error(), "is using") {
if strings.Contains(id, "sha256:") { if strings.Contains(id, "sha256:") {
return buserr.New(constant.ErrObjectInUsed) return buserr.New(constant.ErrObjectInUsed)

View File

@ -441,16 +441,7 @@ func rebuildAllAppInstall() error {
go func(app model.AppInstall) { go func(app model.AppInstall) {
defer wg.Done() defer wg.Done()
dockerComposePath := app.GetComposePath() dockerComposePath := app.GetComposePath()
out, err := compose.Down(dockerComposePath) _, _ = compose.Up(dockerComposePath)
if err != nil {
_ = handleErr(app, err, out)
return
}
out, err = compose.Up(dockerComposePath)
if err != nil {
_ = handleErr(app, err, out)
return
}
app.Status = constant.Running app.Status = constant.Running
_ = appInstallRepo.Save(context.Background(), &app) _ = appInstallRepo.Save(context.Background(), &app)
}(appInstalls[i]) }(appInstalls[i])

View File

@ -186,11 +186,11 @@ const acceptParams = async (params: DialogProps): Promise<void> => {
break; break;
case 'website': case 'website':
title.value = name.value; title.value = name.value;
baseDir.value = `${pathRes.data}/uploads/database/${type.value}/${detailName.value}/`; baseDir.value = `${pathRes.data}/uploads/website/${type.value}/${detailName.value}/`;
break; break;
case 'app': case 'app':
title.value = name.value; title.value = name.value;
baseDir.value = `${pathRes.data}/uploads/database/${type.value}/${name.value}/`; baseDir.value = `${pathRes.data}/uploads/app/${type.value}/${name.value}/`;
} }
upVisible.value = true; upVisible.value = true;
search(); search();

View File

@ -2,7 +2,7 @@
<div class="footer" :style="{ height: mobile ? '108px' : '48px' }"> <div class="footer" :style="{ height: mobile ? '108px' : '48px' }">
<div class="flex w-full flex-col gap-4 md:justify-between md:flex-row"> <div class="flex w-full flex-col gap-4 md:justify-between md:flex-row">
<div class="flex flex-wrap gap-4"> <div class="flex flex-wrap gap-4">
<a href="https://fit2cloud.com/" target="_blank">Copyright © 2014-2024 FIT2CLOUD 飞致云</a> <a href="https://fit2cloud.com/" target="_blank">Copyright © 2014-2024 飞致云</a>
</div> </div>
<div class="flex flex-row gap-2 md:flex-col lg:flex-row"> <div class="flex flex-row gap-2 md:flex-col lg:flex-row">
<SystemUpgrade :footer="true" /> <SystemUpgrade :footer="true" />