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
Benoit Gaussen 4 years ago committed by GitHub
parent da3e26a624
commit 7fb1797fd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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…
Cancel
Save