fw_lab_triage_helper: format DUT summary
TEST=built, executed and inspected DUT summary output for reasonable
alignment
BUG=None
Change-Id: Icd04d13934340d39bc53a26cb61db20f01a845e7
Reviewed-on: https://chromium-review.googlesource.com/1737850
Tested-by: Kevin Shelton <kmshelton@chromium.org>
Commit-Ready: Kevin Shelton <kmshelton@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Greg Edelston <gredelston@google.com>
diff --git a/provingground/firmware/fw_lab_triage_helper.go b/provingground/firmware/fw_lab_triage_helper.go
index 677faec..791d8aa 100644
--- a/provingground/firmware/fw_lab_triage_helper.go
+++ b/provingground/firmware/fw_lab_triage_helper.go
@@ -7,10 +7,12 @@
import (
"fmt"
"log"
+ "os"
"os/exec"
"reflect"
"regexp"
"strings"
+ "text/tabwriter"
)
const labstationTelemetryCmds = "grep guado_labstation-release /etc/lsb-release; " +
@@ -93,10 +95,13 @@
}
log.Print("Summarizing DUT info...")
- // TODO(kmshelton): Use text/tabwriter to make this digestable.
+ w := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', 0)
+ fmt.Fprintln(w, "Hostname\tBoard\tModel\tStatus\tLabstation\tPort\tLockStatus\tLockReason")
for _, dut := range duts {
- fmt.Printf("%+v\n", dut)
+ fmt.Fprintln(w, dut.Hostname+"\t"+dut.Board+"\t"+dut.Model+"\t"+dut.Status+"\t"+dut.Labstation+"\t"+
+ dut.Port+"\t"+dut.LockStatus+"\t"+dut.LockReason+"\t")
}
+ w.Flush()
log.Print("Gathering and displaying key telemetry for labstations.")
// TODO(kmshelton): Do this without keeping two approximately-identical memos.