tests, reporter: define the command only once
@@ -300,13 +300,13 @@ func (r *KubernetesReporter) logAuditLogs(virtCli kubecli.KubevirtClient, since
return
}
// TODO may need to be improved, in case that the auditlog is really huge, since stdout is in memory
- stdout, _, err := tests.ExecuteCommandOnPodV2(virtCli, pod, "virt-handler", []string{"cat", "/proc/1/root/var/log/audit.log"})
+ getAuditLogCmd := []string{"cat", "/proc/1/root/var/log/audit.log"}
+ stdout, _, err := tests.ExecuteCommandOnPodV2(virtCli, pod, "virt-handler", getAuditLogCmd)
if err != nil {
fmt.Fprintf(
os.Stderr,
"failed to execute command %s on node %s, stdout: %s, error: %v",
- []string{"cat", "/proc/1/root/var/log/audit.log"},
- node, stdout, err,
+ getAuditLogCmd, node, stdout, err,
)
return
}
