mirror of https://github.com/k3s-io/k3s.git
Create a "current" symlink to artifact dir in DataDir (#1786)
* Create a current symlink to artifact dir in DataDir * Rename symlink to previous instead of current.prev... Co-authored-by: Gaussen Benoît <benoit.gaussen@orange.com>pull/2100/head
parent
da3e26a624
commit
7fb1797fd3
|
@ -141,5 +141,16 @@ func extract(dataDir string) (string, error) {
|
|||
return "", err
|
||||
}
|
||||
|
||||
currentSymLink := filepath.Join(dataDir, "data", "current")
|
||||
previousSymLink := filepath.Join(dataDir, "data", "previous")
|
||||
if _, err := os.Lstat(currentSymLink); err == nil {
|
||||
if err := os.Rename(currentSymLink, previousSymLink); err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
if err := os.Symlink(dir, currentSymLink); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return dir, os.Rename(tempDest, dir)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue