liuxiaolong
2020-05-30 aa91d7884e7fef55b47d6a4905596f72a5ef1ac3
fix sdkType unTar
1个文件已修改
57 ■■■■ 已修改文件
service/SdkInstall.go 57 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/SdkInstall.go
@@ -108,33 +108,6 @@
                        soM := make(map[string]SdkDef)
                        var skDefArr []SdkDef
                        if err = json.Unmarshal(defB, &skDefArr);err == nil {
                            zconfPath := "/opt/vasystem/bin/zconft/"
                            libPath := "/opt/vasystem/libst/"
                            if !util.DirExists(zconfPath) {
                                os.MkdirAll(zconfPath, 0777)
                            }
                            if !util.DirExists(libPath) {
                                os.MkdirAll(libPath, 0777)
                            }
                            for sdkType,_ := range soM {
                                //先解压SdkType.tar.gz文件
                                if unTarGzE := util.UnTarGz(unPackPath+sdkType+".tar.gz", unPackPath);unTarGzE == nil {
                                    //复制json启动文件
                                    if util.Exists(unPackPath+sdkType+"/zconf/"+sdkType+".json") {
                                        util.CopyFile(unPackPath+sdkType+"/zconf/"+sdkType+".json", zconfPath)
                                    }
                                    if util.DirExists(unPackPath+sdkType+"/"+sdkType) {
                                        if _,cE := util.CopyDirByCmd(unPackPath+sdkType+"/"+sdkType, libPath);cE != nil {
                                            return false, cE
                                        }
                                    }
                                    if util.DirExists(unPackPath+sdkType+"/models") {
                                        if _,cE := util.CopyDirByCmd(unPackPath+sdkType+"/models", "/opt/vasystem/bin/zconft"); cE != nil {
                                            return false, cE
                                        }
                                    }
                                }
                            }
                            //注册算法信息和算法参数到dbserver
                            //var sdkApi dbapi.SdkApi
                            for _,skd := range skDefArr {
@@ -170,6 +143,36 @@
                                logger.Debug("sdkApi.Register paramBody:", paramBody)
                                //sdkApi.Register(paramBody) //将算法注册到数据库中
                            }
                            zconfPath := "/opt/vasystem/bin/zconft/"
                            libPath := "/opt/vasystem/libst/"
                            if !util.DirExists(zconfPath) {
                                os.MkdirAll(zconfPath, 0777)
                            }
                            if !util.DirExists(libPath) {
                                os.MkdirAll(libPath, 0777)
                            }
                            for sdkType,_ := range soM {
                                //先解压SdkType.tar.gz文件
                                if unTarGzE := util.UnTarGz(unPackPath+sdkType+".tar.gz", unPackPath);unTarGzE == nil {
                                    //复制json启动文件
                                    if util.Exists(unPackPath+sdkType+"/zconf/"+sdkType+".json") {
                                        util.CopyFile(unPackPath+sdkType+"/zconf/"+sdkType+".json", zconfPath)
                                    }
                                    if util.DirExists(unPackPath+sdkType+"/"+sdkType) {
                                        if _,cE := util.CopyDirByCmd(unPackPath+sdkType+"/"+sdkType, libPath);cE != nil {
                                            return false, cE
                                        }
                                    }
                                    if util.DirExists(unPackPath+sdkType+"/models") {
                                        if _,cE := util.CopyDirByCmd(unPackPath+sdkType+"/models", "/opt/vasystem/bin/zconft"); cE != nil {
                                            return false, cE
                                        }
                                    }
                                } else {
                                    logger.Debug("unTarGzE sdkType.tar.gz err:", unTarGzE)
                                }
                            }
                        } else {
                            return false, errors.New("反序列化算法定义信息失败")
                        }