mirror of
				https://github.com/1Panel-dev/1Panel.git
				synced 2025-10-31 03:07:34 +08:00 
			
		
		
		
	fix: 解决本地应用备份恢复报错的问题 (#2879)
Refs https://github.com/1Panel-dev/1Panel/issues/2854
This commit is contained in:
		
							parent
							
								
									24098e397f
								
							
						
					
					
						commit
						8660ac6fe5
					
				
					 2 changed files with 5 additions and 7 deletions
				
			
		|  | @ -27,18 +27,18 @@ type AppInstall struct { | |||
| } | ||||
| 
 | ||||
| func (i *AppInstall) GetPath() string { | ||||
| 	return path.Join(i.getAppPath(), i.Name) | ||||
| 	return path.Join(i.GetAppPath(), i.Name) | ||||
| } | ||||
| 
 | ||||
| func (i *AppInstall) GetComposePath() string { | ||||
| 	return path.Join(i.getAppPath(), i.Name, "docker-compose.yml") | ||||
| 	return path.Join(i.GetAppPath(), i.Name, "docker-compose.yml") | ||||
| } | ||||
| 
 | ||||
| func (i *AppInstall) GetEnvPath() string { | ||||
| 	return path.Join(i.getAppPath(), i.Name, ".env") | ||||
| 	return path.Join(i.GetAppPath(), i.Name, ".env") | ||||
| } | ||||
| 
 | ||||
| func (i *AppInstall) getAppPath() string { | ||||
| func (i *AppInstall) GetAppPath() string { | ||||
| 	if i.App.Resource == constant.AppResourceLocal { | ||||
| 		return path.Join(constant.LocalAppInstallDir, strings.TrimPrefix(i.App.Key, constant.AppResourceLocal)) | ||||
| 	} else { | ||||
|  |  | |||
|  | @ -225,7 +225,7 @@ func handleAppRecover(install *model.AppInstall, recoverFile string, isRollback | |||
| 	_ = fileOp.Rename(appDir, backPath) | ||||
| 	_ = fileOp.CreateDir(appDir, 0755) | ||||
| 
 | ||||
| 	if err := handleUnTar(tmpPath+"/app.tar.gz", fmt.Sprintf("%s/%s", constant.AppInstallDir, install.App.Key)); err != nil { | ||||
| 	if err := handleUnTar(tmpPath+"/app.tar.gz", install.GetAppPath()); err != nil { | ||||
| 		global.LOG.Errorf("handle recover from app.tar.gz failed, err: %v", err) | ||||
| 		_ = fileOp.DeleteDir(appDir) | ||||
| 		_ = fileOp.Rename(backPath, appDir) | ||||
|  | @ -248,8 +248,6 @@ func handleAppRecover(install *model.AppInstall, recoverFile string, isRollback | |||
| 	oldInstall.AppId = install.AppId | ||||
| 	oldInstall.AppDetailId = install.AppDetailId | ||||
| 	oldInstall.App.ID = install.AppId | ||||
| 	oldInstall.Env = strings.ReplaceAll(oldInstall.Env, oldInstall.ContainerName, install.ContainerName) | ||||
| 	oldInstall.ContainerName = install.ContainerName | ||||
| 	if err := appInstallRepo.Save(context.Background(), &oldInstall); err != nil { | ||||
| 		global.LOG.Errorf("save db app install failed, err: %v", err) | ||||
| 		return err | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue