mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 23:15:14 +00:00
Make sure the previous symlink file is deleted
before trying to create a new one.
This commit is contained in:
parent
20fa30e4b5
commit
9f81cf096b
@ -227,6 +227,10 @@ func (ds *dockerService) createContainerLogSymlink(containerID string) error {
|
||||
|
||||
if realPath != "" {
|
||||
// Only create the symlink when container log path is specified and log file exists.
|
||||
// Delete possibly existing file first
|
||||
if err = ds.os.Remove(path); err == nil {
|
||||
glog.Warningf("Deleted previously existing symlink file: %q", path)
|
||||
}
|
||||
if err = ds.os.Symlink(realPath, path); err != nil {
|
||||
return fmt.Errorf("failed to create symbolic link %q to the container log file %q for container %q: %v",
|
||||
path, realPath, containerID, err)
|
||||
|
Loading…
Reference in New Issue
Block a user