Skip to content

Commit

Permalink
fix: allow 'empty user' slots to be used in IPMI setup
Browse files Browse the repository at this point in the history
Fixes #1078

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
  • Loading branch information
smira committed Apr 19, 2023
1 parent 2b3dedc commit b2c53bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion app/sidero-controller-manager/cmd/agent/bmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"log"
"math/big"
"net"
"strings"
"time"

"github.com/siderolabs/go-retry/retry"
Expand Down Expand Up @@ -128,7 +129,7 @@ func attemptBMCUserSetup(ctx context.Context, client api.AgentClient, s *smbios.
log.Printf("Sidero user already present in slot %d. We'll claim it as our very own.\n", i)

break
} else if userRes.Username == "" && sideroUserID == 0 {
} else if (userRes.Username == "" || strings.TrimSpace(userRes.Username) == "(Empty User)") && sideroUserID == 0 {
// If this is the first empty user that's not the UID 1 (which we skip),
// we'll take this spot for sidero user
log.Printf("Found empty user slot %d. Noting as a possible place for sidero user.\n", i)
Expand Down
8 changes: 4 additions & 4 deletions app/sidero-controller-manager/cmd/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func mainFunc() error {
log.Println("failed to discover IPs")
} else {
if err = reconcileIPs(ctx, client, s, ips); err != nil {
shutdown(err)
return err
}

log.Printf("Reconciled IPs")
Expand All @@ -93,7 +93,7 @@ func mainFunc() error {
if createResp.GetWipe() {
disks, err := disk.List()
if err != nil {
shutdown(err)
return err
}

var (
Expand Down Expand Up @@ -176,11 +176,11 @@ func mainFunc() error {
}

if err := eg.Wait(); err != nil {
shutdown(err)
return err
}

if err := wipe(ctx, client, s); err != nil {
shutdown(err)
return err
}

log.Println("Wipe complete")
Expand Down

0 comments on commit b2c53bf

Please sign in to comment.