Skip to content

Commit

Permalink
Merge pull request #415 from HewlettPackard/remove_available_sh
Browse files Browse the repository at this point in the history
fixed hw check  during profile creation
  • Loading branch information
akshith-gunasheelan authored Apr 24, 2024
2 parents df4890a + d714082 commit 404b6fd
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions ov/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"encoding/json"
"errors"
"fmt"
"os"
"reflect"
"strings"

Expand Down Expand Up @@ -447,19 +446,9 @@ func (c *OVClient) SubmitNewProfile(p ServerProfile, ignoreFlags ...ForceFlag) (
log.Debugf("REST : %s \n %+v\n", uri, p)
log.Debugf("task -> %+v", t)

// Get available server hardwares to assign it to SP
if p.ServerHardwareURI != "" {

isHardwareAvailable, err := c.GetAvailableServers(p.ServerHardwareURI.String())
if err != nil || isHardwareAvailable == false {
log.Errorf("Error getting available Hardware: %s", p.ServerHardwareURI.String())
if err != nil {
log.Warnf("Error: %s", err)
}
os.Exit(1)
}

server, err = c.GetServerHardwareByUri(p.ServerHardwareURI)
// Check if server hardware already has server profile assigned
if server.ServerProfileURI.String() != "null" {
return fmt.Errorf("hardware %s already has server profile assigned", server.Name)
}

server, err = c.GetServerHardwareByUri(p.ServerHardwareURI)
Expand Down

0 comments on commit 404b6fd

Please sign in to comment.