removeContainerLogSymlink removes the symlink for docker container log.
(containerID string)
| 204 | |
| 205 | // removeContainerLogSymlink removes the symlink for docker container log. |
| 206 | func (ds *dockerService) removeContainerLogSymlink(containerID string) error { |
| 207 | path, _, err := ds.getContainerLogPath(containerID) |
| 208 | if err != nil { |
| 209 | return fmt.Errorf("failed to get container %q log path: %v", containerID, err) |
| 210 | } |
| 211 | if path != "" { |
| 212 | // Only remove the symlink when container log path is specified. |
| 213 | err := ds.os.Remove(path) |
| 214 | if err != nil && !os.IsNotExist(err) { |
| 215 | return fmt.Errorf( |
| 216 | "failed to remove container %q log symlink %q: %v", |
| 217 | containerID, |
| 218 | path, |
| 219 | err, |
| 220 | ) |
| 221 | } |
| 222 | } |
| 223 | return nil |
| 224 | } |
no test coverage detected