fix: 网元OAM配置同步文件创建覆盖

This commit is contained in:
TsMask
2024-05-07 09:50:10 +08:00
parent fa316be3d4
commit 4568bba018

View File

@@ -598,7 +598,9 @@ func (r *NeInfoImpl) NeConfOAMWirte(neType, neId string, content any, sync bool)
neFilePath := fmt.Sprintf("/usr/local/etc/%s/%s", neTypeLower, fileName)
neFileDir := filepath.Dir(neFilePath)
// 修改网元文件权限
sshClient.RunCMD(fmt.Sprintf("sudo mkdir -p %s && sudo chmod o+w %s && sudo chmod o+w %s", neFileDir, neFileDir, neFilePath))
if _, err = sshClient.RunCMD(fmt.Sprintf("sudo mkdir -p %s && sudo chmod o+w %s && sudo chmod o+w %s", neFileDir, neFileDir, neFilePath)); err != nil {
sshClient.RunCMD(fmt.Sprintf("sudo touch %s && sudo chmod o+w %s", neFilePath, neFilePath))
}
// 复制到网元进行覆盖
if err = sftpClient.CopyFileLocalToRemote(localFilePath, neFilePath); err != nil {
return fmt.Errorf("please check if scp remote copy is allowed")