MCPcopy
hub / github.com/google/seesaw / showHAStatus

Function showHAStatus

cli/show.go:140–162  ·  view source on GitHub ↗
(cli *SeesawCLI, args []string)

Source from the content-addressed store, hash-verified

138}
139
140func showHAStatus(cli *SeesawCLI, args []string) error {
141 ha, err := cli.seesaw.HAStatus()
142 if err != nil {
143 return fmt.Errorf("HA status: %v\n", err)
144 }
145
146 durationStr := "N/A"
147 if !ha.Since.IsZero() {
148 duration := time.Duration(time.Now().Sub(ha.Since).Seconds()) * time.Second
149 since := ha.Since.Format(timeStamp)
150 durationStr = fmt.Sprintf("%s (since %s)", duration, since)
151 }
152
153 printHdr("HA Status")
154 printVal("State:", ha.State)
155 printVal("Duration:", durationStr)
156 printVal("Transitions:", ha.Transitions)
157 printVal("Advertisements Sent:", ha.Sent)
158 printVal("Advertisements Rcvd:", ha.Received)
159 printVal("Last Update:", ha.LastUpdate.Format(timeStamp))
160
161 return nil
162}
163
164func configStatus(cli *SeesawCLI, args []string) error {
165 cs, err := cli.seesaw.ConfigStatus()

Callers

nothing calls this directly

Calls 3

printHdrFunction · 0.85
printValFunction · 0.85
HAStatusMethod · 0.65

Tested by

no test coverage detected