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")
for _, line := range lines {
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 {
pushAlert := dto.PushAlert{
TaskName: clamName,

View file

@ -432,7 +432,7 @@ func (u *ImageService) ImageRemove(req dto.BatchDelete) error {
}
defer client.Close()
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(id, "sha256:") {
return buserr.New(constant.ErrObjectInUsed)

View file

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

View file

@ -186,11 +186,11 @@ const acceptParams = async (params: DialogProps): Promise<void> => {
break;
case 'website':
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;
case 'app':
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;
search();

View file

@ -2,7 +2,7 @@
<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 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 class="flex flex-row gap-2 md:flex-col lg:flex-row">
<SystemUpgrade :footer="true" />