diff --git a/pkg/podman/component.go b/pkg/podman/component.go index 483aba77f50..36513abc329 100644 --- a/pkg/podman/component.go +++ b/pkg/podman/component.go @@ -18,7 +18,9 @@ type ListPodsReport struct { } func (o *PodmanCli) ListAllComponents() ([]api.ComponentAbstract, error) { - out, err := exec.Command(o.podmanCmd, "pod", "ps", "--format", "json", "--filter", "status=running").Output() + cmd := exec.Command(o.podmanCmd, "pod", "ps", "--format", "json", "--filter", "status=running") + klog.V(3).Infof("executing %v", cmd.Args) + out, err := cmd.Output() if err != nil { if exiterr, ok := err.(*exec.ExitError); ok { err = fmt.Errorf("%s: %s", err, string(exiterr.Stderr)) @@ -32,10 +34,10 @@ func (o *PodmanCli) ListAllComponents() ([]api.ComponentAbstract, error) { } for _, pod := range list { - klog.V(5).Infof("\npod name: %s\n", pod.Name) - klog.V(5).Infof("labels:\n") + klog.V(5).Infof("\npod name: %s", pod.Name) + klog.V(5).Infof("labels:") for k, v := range pod.Labels { - klog.V(5).Infof(" - %s: %s\n", k, v) + klog.V(5).Infof(" - %s: %s", k, v) } } diff --git a/pkg/podman/exec.go b/pkg/podman/exec.go index a088ca1831c..83ddf034c5e 100644 --- a/pkg/podman/exec.go +++ b/pkg/podman/exec.go @@ -22,9 +22,9 @@ func (o *PodmanCli) ExecCMDInContainer(containerName, podName string, cmd []stri args = append(args, cmd...) command := exec.Command(o.podmanCmd, args...) + klog.V(3).Infof("executing %v", command.Args) command.Stdin = stdin - klog.V(4).Infof("exec %s %v\n", o.podmanCmd, args) out, err := command.Output() if err != nil { return err diff --git a/pkg/podman/podman.go b/pkg/podman/podman.go index a060f0ee321..515655634a7 100644 --- a/pkg/podman/podman.go +++ b/pkg/podman/podman.go @@ -47,6 +47,7 @@ func (o *PodmanCli) PlayKube(pod *corev1.Pod) error { ) cmd := exec.Command(o.podmanCmd, "play", "kube", "-") + klog.V(3).Infof("executing %v", cmd.Args) stdin, err := cmd.StdinPipe() if err != nil { return err @@ -89,7 +90,9 @@ func (o *PodmanCli) PlayKube(pod *corev1.Pod) error { } func (o *PodmanCli) PodStop(podname string) error { - out, err := exec.Command(o.podmanCmd, "pod", "stop", podname).Output() + cmd := exec.Command(o.podmanCmd, "pod", "stop", podname) + out, err := cmd.Output() + klog.V(3).Infof("executing %v", cmd.Args) if err != nil { if exiterr, ok := err.(*exec.ExitError); ok { err = fmt.Errorf("%s: %s", err, string(exiterr.Stderr)) @@ -101,7 +104,9 @@ func (o *PodmanCli) PodStop(podname string) error { } func (o *PodmanCli) PodRm(podname string) error { - out, err := exec.Command(o.podmanCmd, "pod", "rm", podname).Output() + cmd := exec.Command(o.podmanCmd, "pod", "rm", podname) + out, err := cmd.Output() + klog.V(3).Infof("executing %v", cmd.Args) if err != nil { if exiterr, ok := err.(*exec.ExitError); ok { err = fmt.Errorf("%s: %s", err, string(exiterr.Stderr)) @@ -113,7 +118,9 @@ func (o *PodmanCli) PodRm(podname string) error { } func (o *PodmanCli) VolumeRm(volumeName string) error { - out, err := exec.Command(o.podmanCmd, "volume", "rm", volumeName).Output() + cmd := exec.Command(o.podmanCmd, "volume", "rm", volumeName) + out, err := cmd.Output() + klog.V(3).Infof("executing %v", cmd.Args) if err != nil { if exiterr, ok := err.(*exec.ExitError); ok { err = fmt.Errorf("%s: %s", err, string(exiterr.Stderr)) @@ -125,7 +132,9 @@ func (o *PodmanCli) VolumeRm(volumeName string) error { } func (o *PodmanCli) VolumeLs() (map[string]bool, error) { - out, err := exec.Command(o.podmanCmd, "volume", "ls", "--format", "{{.Name}}", "--noheading").Output() + cmd := exec.Command(o.podmanCmd, "volume", "ls", "--format", "{{.Name}}", "--noheading") + out, err := cmd.Output() + klog.V(3).Infof("executing %v", cmd.Args) if err != nil { if exiterr, ok := err.(*exec.ExitError); ok { err = fmt.Errorf("%s: %s", err, string(exiterr.Stderr)) diff --git a/pkg/podman/version.go b/pkg/podman/version.go index b9af97a876f..a1f842212cb 100644 --- a/pkg/podman/version.go +++ b/pkg/podman/version.go @@ -4,6 +4,8 @@ import ( "encoding/json" "fmt" "os/exec" + + "k8s.io/klog" ) type Version struct { @@ -22,7 +24,9 @@ type SystemVersionReport struct { } func (o *PodmanCli) Version() (SystemVersionReport, error) { - out, err := exec.Command(o.podmanCmd, "version", "--format", "json").Output() + cmd := exec.Command(o.podmanCmd, "version", "--format", "json") + out, err := cmd.Output() + klog.V(3).Infof("executing %v", cmd.Args) if err != nil { if exiterr, ok := err.(*exec.ExitError); ok { err = fmt.Errorf("%s: %s", err, string(exiterr.Stderr))