mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-29 18:27:58 +08:00
[REV] update code for restore volume
This commit is contained in:
parent
64f46bf9a5
commit
3611c1c991
@ -197,15 +197,16 @@ func (b *BackupAPPRestore) restoreVersionAndData(backup *dbmodel.AppBackup, appS
|
||||
logrus.Errorf("restore statefulset service(%s) volume(%s) data error.%s", app.ServiceID, volume.VolumeName, err.Error())
|
||||
return err
|
||||
}
|
||||
for _, podName := range list {
|
||||
newNameTmp := strings.Split(podName, "-")
|
||||
for _, path := range list {
|
||||
newNameTmp := strings.Split(filepath.Base(path), "-")
|
||||
newNameTmp[0] = b.serviceChange[b.getOldServiceID(app.ServiceID)].ServiceAlias
|
||||
newName := strings.Join(newNameTmp, "-")
|
||||
err := util.Rename(filepath.Join(tmpDir, podName), filepath.Join(tmpDir, newName))
|
||||
newpath := filepath.Join(util.GetParentDirectory(path), newName)
|
||||
err := util.Rename(path, newpath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := os.Chmod(filepath.Join(tmpDir, newName), 0777); err != nil {
|
||||
if err := os.Chmod(newpath, 0777); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ func GetDirList(dirpath string, level int) ([]string, error) {
|
||||
for _, f := range list {
|
||||
if f.IsDir() {
|
||||
if level <= 1 {
|
||||
dirlist = append(dirlist, f.Name())
|
||||
dirlist = append(dirlist, filepath.Join(dirpath, f.Name()))
|
||||
} else {
|
||||
list, err := GetDirList(filepath.Join(dirpath, f.Name()), level-1)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user