From f1b99dff3fbd04cdc8b40c6d0a16bc5e5517bea0 Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Fri, 26 May 2023 11:18:17 +0100 Subject: [PATCH] Parse response from requeued VMs Signed-off-by: Alex Ellis (OpenFaaS Ltd) --- cmd/repair.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/repair.go b/cmd/repair.go index 3f6e2f0..56e62a3 100644 --- a/cmd/repair.go +++ b/cmd/repair.go @@ -1,6 +1,7 @@ package cmd import ( + "encoding/json" "fmt" "net/http" "os" @@ -67,8 +68,17 @@ func runRepairE(cmd *cobra.Command, args []string) error { fmt.Printf("Repair requested for %s, status: %d\n", owner, status) if strings.TrimSpace(res) != "" { - fmt.Printf("Response: %s\n", res) + repairRes := RepairRes{} + if err := json.Unmarshal([]byte(res), &repairRes); err != nil { + return err + } + + fmt.Printf("Requeued VMs: %d\n", repairRes.VMs) } return nil } + +type RepairRes struct { + VMs int `json:"vms"` +}