Skip to content

Commit

Permalink
fix: ensure we setup BMC info *after* disk wiping
Browse files Browse the repository at this point in the history
This PR changes the order of operations so that the BMC gets setup after
the disk wipes occur. This lets us avoid an issue where we could
accidentally power off the box during wiping.

Signed-off-by: Spencer Smith <spencer.smith@talos-systems.com>
(cherry picked from commit ed39a3c)
  • Loading branch information
rsmitty authored and smira committed Dec 16, 2021
1 parent 03e38da commit 32b80d9
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions app/sidero-controller-manager/cmd/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,26 +260,6 @@ func mainFunc() error {

log.Println("Registration complete")

if createResp.GetSetupBmc() {
log.Println("Attempting to automatically discover and configure BMC")

// Attempt to discover the BMC IP
// nb: we don't consider failure to get BMC info a hard failure
// users can always patch the bmc info to the server themselves.
err := attemptBMCIP(ctx, client, s)
if err != nil {
log.Printf("encountered error discovering BMC IP. skipping setup: %q", err.Error())
} else {
// Attempt to add sidero user to BMC only if we discovered the IP
// nb: we don't consider failure to get BMC info a hard failure.
// users can always patch the bmc info to the server themselves.
err = attemptBMCUserSetup(ctx, client, s)
if err != nil {
log.Printf("encountered error setting up BMC user. skipping setup: %q", err.Error())
}
}
}

ips, err := talosnet.IPAddrs()
if err != nil {
log.Println("failed to discover IPs")
Expand Down Expand Up @@ -384,6 +364,26 @@ func mainFunc() error {
log.Println("Wipe complete")
}

if createResp.GetSetupBmc() {
log.Println("Attempting to automatically discover and configure BMC")

// Attempt to discover the BMC IP
// nb: we don't consider failure to get BMC info a hard failure
// users can always patch the bmc info to the server themselves.
err := attemptBMCIP(ctx, client, s)
if err != nil {
log.Printf("encountered error discovering BMC IP. skipping setup: %q", err.Error())
} else {
// Attempt to add sidero user to BMC only if we discovered the IP
// nb: we don't consider failure to get BMC info a hard failure.
// users can always patch the bmc info to the server themselves.
err = attemptBMCUserSetup(ctx, client, s)
if err != nil {
log.Printf("encountered error setting up BMC user. skipping setup: %q", err.Error())
}
}
}

return nil
}

Expand Down

0 comments on commit 32b80d9

Please sign in to comment.