fix: 远程网元文件目录权限775
This commit is contained in:
@@ -463,7 +463,7 @@ func (r *NeInfoImpl) neConfOAMWirte(neType, neId string, content any, sync bool)
|
||||
neFilePath := fmt.Sprintf("/usr/local/etc/%s/%s", neTypeLower, fileName)
|
||||
neFileDir := filepath.ToSlash(filepath.Dir(neFilePath))
|
||||
// 修改网元文件权限
|
||||
sshClient.RunCMD(fmt.Sprintf("sudo mkdir -p %s && sudo chmod o+w %s && sudo touch %s && sudo chmod o+w %s", neFileDir, neFileDir, neFilePath, neFilePath))
|
||||
sshClient.RunCMD(fmt.Sprintf("sudo mkdir -p %s && sudo chmod 775 %s && sudo touch %s && sudo chmod o+w %s", neFileDir, neFileDir, neFilePath, neFilePath))
|
||||
// 复制到网元进行覆盖
|
||||
if err = sftpClient.CopyFileLocalToRemote(localFilePath, neFilePath); err != nil {
|
||||
return fmt.Errorf("please check if scp remote copy is allowed")
|
||||
@@ -627,7 +627,7 @@ func (r *NeInfoImpl) NeConfPara5GWirte(content map[string]any, syncNE []string)
|
||||
neFilePath := "/usr/local/etc/conf/para5G.yaml"
|
||||
neFileDir := filepath.ToSlash(filepath.Dir(neFilePath))
|
||||
// 修改网元文件权限
|
||||
sshClient.RunCMD(fmt.Sprintf("sudo mkdir -p %s && sudo chmod o+w %s && sudo touch %s && sudo chmod o+w %s", neFileDir, neFileDir, neFilePath, neFilePath))
|
||||
sshClient.RunCMD(fmt.Sprintf("sudo mkdir -p %s && sudo chmod 775 %s && sudo touch %s && sudo chmod o+rw %s", neFileDir, neFileDir, neFilePath, neFilePath))
|
||||
// 复制到网元进行覆盖
|
||||
if err = sftpClient.CopyFileLocalToRemote(omcFilePath, neFilePath); err != nil {
|
||||
errMsg = append(errMsg, fmt.Sprintf("%s : please check if scp remote copy is allowed", ti))
|
||||
|
||||
@@ -166,7 +166,7 @@ func (r *NeLicenseImpl) UploadLicense(neLicense model.NeLicense) error {
|
||||
neLicensePath := fmt.Sprintf("/usr/local/etc/%s/license/system.ini", neTypeLower)
|
||||
neLicenseDir := filepath.ToSlash(filepath.Dir(neLicensePath))
|
||||
// 修改网元文件权限
|
||||
sshClient.RunCMD(fmt.Sprintf("sudo chmod o+w %s && sudo chmod o+w %s", neLicenseDir, neLicensePath))
|
||||
sshClient.RunCMD(fmt.Sprintf("sudo chmod 775 %s && sudo chmod o+w %s", neLicenseDir, neLicensePath))
|
||||
|
||||
// 尝试备份授权文件
|
||||
neLicensePathBack := fmt.Sprintf("%s/system_%s.ini", neLicensePath, time.Now().Format("20060102_150405"))
|
||||
|
||||
@@ -137,7 +137,7 @@ func (r *NeVersionImpl) Operate(action string, neVersion model.NeVersion, preinp
|
||||
return "", fmt.Errorf("error read para5G file info")
|
||||
}
|
||||
if err := NewNeInfoImpl.NeConfPara5GWirte(para5GMap, []string{fmt.Sprintf("%s@%s", neInfo.NeType, neInfo.NeId)}); err != nil {
|
||||
return "", fmt.Errorf("error wirte OAM file info")
|
||||
return "", fmt.Errorf("error wirte para5G file info")
|
||||
}
|
||||
// ========= 网元公共配置文件 end ===========
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user