fix: 解决安装应用同步之后变为失败的 BUG (#525)

pull/526/head
zhengkunwang223 2 years ago committed by GitHub
parent e452dfdb1f
commit a0e4c266a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -249,17 +249,12 @@ func (a AppService) Install(ctx context.Context, req request.AppInstallCreate) (
return nil, err
}
paramByte, err := json.Marshal(req.Params)
if err != nil {
return nil, err
}
appInstall := model.AppInstall{
Name: req.Name,
AppId: appDetail.AppId,
AppDetailId: appDetail.ID,
Version: appDetail.Version,
Status: constant.Installing,
Env: string(paramByte),
HttpPort: httpPort,
HttpsPort: httpsPort,
App: app,
@ -301,11 +296,15 @@ func (a AppService) Install(ctx context.Context, req request.AppInstallCreate) (
if err := copyAppData(app.Key, appDetail.Version, req.Name, req.Params); err != nil {
return nil, err
}
fileOp := files.NewFileOp()
if err := fileOp.WriteFile(appInstall.GetComposePath(), strings.NewReader(string(composeByte)), 0775); err != nil {
return nil, err
}
paramByte, err := json.Marshal(req.Params)
if err != nil {
return nil, err
}
appInstall.Env = string(paramByte)
if err := appInstallRepo.Create(ctx, &appInstall); err != nil {
return nil, err

Loading…
Cancel
Save