Skip to content

Commit

Permalink
... if speed is empty, set it to 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
guettli committed Jan 6, 2025
1 parent 1fdb53a commit c6f35d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/services/baremetal/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,10 +858,16 @@ func obtainHardwareDetailsNics(sshClient sshclient.Client) ([]infrav1.NIC, error
if err := json.Unmarshal([]byte(validJSONString), &nic); err != nil {
return nil, fmt.Errorf("failed to unmarshal %v. Original ssh output %s: %w", validJSONString, stdOut, err)
}

// speedMbps can be empty
if nic.SpeedMbps == "" {
nic.SpeedMbps = "0"
}
speedMbps, err := strconv.Atoi(nic.SpeedMbps)
if err != nil {
return nil, fmt.Errorf("failed to parse int from string %s: %w", nic.SpeedMbps, err)
}

nicsArray[i] = infrav1.NIC{
Name: nic.Name,
Model: nic.Model,
Expand Down

0 comments on commit c6f35d3

Please sign in to comment.