Skip to content

Commit

Permalink
Parse response from requeued VMs
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed May 26, 2023
1 parent 77225fb commit f1b99df
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/repair.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"encoding/json"
"fmt"
"net/http"
"os"
Expand Down Expand Up @@ -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"`
}

0 comments on commit f1b99df

Please sign in to comment.