D65 = A: the busy file the agent reads before an operator reboot, and the household's 'Felhom support restarted your box' line; R-1350: a hold clear records the wanted stop so no app_start_failed follows it
gates / gates (push) Successful in 32s
gates / gates (push) Successful in 32s
This commit is contained in:
1 parent
a28db2d17f
commit
b69e90bdad
22 files changed
+662
-11
No files matched your search
@@ -0,0 +1,33 @@
|
||||
package agentapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
// OperatorReboot calls GET /guest/operator-reboot (D65 = A, agent ≥ the reboot_guest commit): the time the operator
|
||||
// rebooted THIS guest from the hub, when it is less than a day old; the zero time when there is none. An agent that
|
||||
// predates the route answers 404 (a *StatusError) — such an agent cannot reboot from the hub either, so there is
|
||||
// nothing to show and no MinAgent is needed.
|
||||
func (c *Client) OperatorReboot(ctx context.Context) (time.Time, error) {
|
||||
body, err := c.get(ctx, "/guest/operator-reboot")
|
||||
if err != nil {
|
||||
return time.Time{}, err
|
||||
}
|
||||
var out struct {
|
||||
At string `json:"at"`
|
||||
}
|
||||
if err := json.Unmarshal(body, &out); err != nil {
|
||||
return time.Time{}, fmt.Errorf("agentapi: decode /guest/operator-reboot: %w", err)
|
||||
}
|
||||
if out.At == "" {
|
||||
return time.Time{}, nil
|
||||
}
|
||||
at, err := time.Parse(time.RFC3339, out.At)
|
||||
if err != nil {
|
||||
return time.Time{}, fmt.Errorf("agentapi: /guest/operator-reboot: bad time %q", out.At)
|
||||
}
|
||||
return at, nil
|
||||
}
|
||||
Reference in new issue
Block a user