-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FS-1729; Set/Upload BiosCfg skeleton
- move actions to their own file for cleanliness - Update Rivets, add new biosControl action - add new biosControl action to handler - add new functions to store/bmc to support SetBiosConfig - TODO; Add correct bmcClient call in store/bmc
- Loading branch information
1 parent
c5a94cc
commit 51dcc6b
Showing
7 changed files
with
89 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package bioscfg | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/metal-toolbox/bioscfg/internal/model" | ||
) | ||
|
||
// ResetBios reset the bios of the server | ||
func (th *TaskHandler) ResetBiosConfig(ctx context.Context) error { | ||
// Get Power State | ||
state, err := th.bmcClient.GetPowerState(ctx) | ||
if err != nil { | ||
return th.failedWithError(ctx, "error getting power state", err) | ||
} | ||
|
||
err = th.publishActivef(ctx, "current power state: %s", state) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// Reset Bios | ||
err = th.bmcClient.ResetBiosConfig(ctx) | ||
if err != nil { | ||
return th.failedWithError(ctx, "error reseting bios", err) | ||
} | ||
|
||
err = th.publishActive(ctx, "BIOS settings reset") | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// Reboot (if ON) | ||
if state == model.PowerStateOn { | ||
err = th.bmcClient.SetPowerState(ctx, model.PowerStateReset) | ||
if err != nil { | ||
return th.failedWithError(ctx, "failed to reboot server", err) | ||
} | ||
|
||
return th.successful(ctx, "rebooting server") | ||
} | ||
|
||
return th.successful(ctx, "skipping server reboot, not on") | ||
} | ||
|
||
// UploadConfig set BIOS Config | ||
func (th *TaskHandler) SetBiosConfig(ctx context.Context) error { | ||
// TODO | ||
return th.bmcClient.SetBiosConfig(ctx) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters