mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Make sure the previous symlink file is deleted
before trying to create a new one.
This commit is contained in:
		@@ -227,6 +227,10 @@ func (ds *dockerService) createContainerLogSymlink(containerID string) error {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if realPath != "" {
 | 
						if realPath != "" {
 | 
				
			||||||
		// Only create the symlink when container log path is specified and log file exists.
 | 
							// 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 {
 | 
							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",
 | 
								return fmt.Errorf("failed to create symbolic link %q to the container log file %q for container %q: %v",
 | 
				
			||||||
				path, realPath, containerID, err)
 | 
									path, realPath, containerID, err)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user