fix: 网元OAM配置同步文件创建覆盖
This commit is contained in:
@@ -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)
|
neFilePath := fmt.Sprintf("/usr/local/etc/%s/%s", neTypeLower, fileName)
|
||||||
neFileDir := filepath.Dir(neFilePath)
|
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 {
|
if err = sftpClient.CopyFileLocalToRemote(localFilePath, neFilePath); err != nil {
|
||||||
return fmt.Errorf("please check if scp remote copy is allowed")
|
return fmt.Errorf("please check if scp remote copy is allowed")
|
||||||
|
|||||||
Reference in New Issue
Block a user