@@ -270,10 +270,6 @@ func (r *runtime) GetPods(all bool) ([]*kubecontainer.Pod, error) {
270270
271271 var kubepods []* kubecontainer.Pod
272272 for _ , podInfo := range podInfos {
273- if ! all && podInfo .Status != "running" {
274- continue
275- }
276-
277273 var pod kubecontainer.Pod
278274 var containers []* kubecontainer.Container
279275
@@ -861,8 +857,33 @@ func (r *runtime) RemoveImage(image kubecontainer.ImageSpec) error {
861857// stream the log. Set 'follow' to false and specify the number of lines (e.g.
862858// "100" or "all") to tail the log.
863859func (r * runtime ) GetContainerLogs (pod * api.Pod , containerID kubecontainer.ContainerID , logOptions * api.PodLogOptions , stdout , stderr io.Writer ) error {
864- // TODO: get container logs for hyper
865- return fmt .Errorf ("Hyper: GetContainerLogs unimplemented" )
860+ glog .V (4 ).Infof ("Hyper: running logs on container %s" , containerID .ID )
861+
862+ args := append ([]string {}, "logs" )
863+ if logOptions .Follow {
864+ args = append (args , "--follow" )
865+ }
866+ if * logOptions .SinceSeconds != 0 {
867+ args = append (args , fmt .Sprintf ("--since=%d" , * logOptions .SinceSeconds ))
868+ }
869+ if * logOptions .TailLines != 0 {
870+ args = append (args , fmt .Sprintf ("--tail=%d" , * logOptions .TailLines ))
871+ }
872+ if logOptions .Timestamps {
873+ args = append (args , "--timestamps" )
874+ }
875+
876+ command := r .buildCommand (args ... )
877+ p , err := kubecontainer .StartPty (command )
878+ if err != nil {
879+ return err
880+ }
881+ defer p .Close ()
882+
883+ if stdout != nil {
884+ go io .Copy (stdout , p )
885+ }
886+ return command .Wait ()
866887}
867888
868889// Runs the command in the container of the specified pod
@@ -909,7 +930,6 @@ func (r *runtime) ExecInContainer(containerID kubecontainer.ContainerID, cmd []s
909930 go io .Copy (stdout , p )
910931 }
911932 return command .Wait ()
912-
913933}
914934
915935func (r * runtime ) AttachContainer (containerID kubecontainer.ContainerID , stdin io.Reader , stdout , stderr io.WriteCloser , tty bool ) error {
0 commit comments