Skip to content

Commit

Permalink
Merge pull request #23658 from Random-Liu/fix-termination-message-path
Browse files Browse the repository at this point in the history
Fix TerminationMessagePath
  • Loading branch information
j3ffml committed Apr 9, 2016
2 parents 347158e + 5dbac3a commit 1a9cb97
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pkg/kubelet/dockertools/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,14 @@ func (dm *DockerManager) inspectContainer(id string, podName, podNamespace strin

terminationMessagePath := containerInfo.TerminationMessagePath
if terminationMessagePath != "" {
if path, found := iResult.Volumes[terminationMessagePath]; found {
if data, err := ioutil.ReadFile(path); err != nil {
message = fmt.Sprintf("Error on reading termination-log %s: %v", path, err)
} else {
message = string(data)
for _, mount := range iResult.Mounts {
if mount.Destination == terminationMessagePath {
path := mount.Source
if data, err := ioutil.ReadFile(path); err != nil {
message = fmt.Sprintf("Error on reading termination-log %s: %v", path, err)
} else {
message = string(data)
}
}
}
}
Expand Down

0 comments on commit 1a9cb97

Please sign in to comment.