Skip to content

Commit

Permalink
we can now return on errors since vendor specifics are handled by go-…
Browse files Browse the repository at this point in the history
…hal (#39)
  • Loading branch information
Sandro Koll authored Nov 23, 2020
1 parent 7d71dbb commit 76e9e31
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
15 changes: 8 additions & 7 deletions cmd/bios.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@ func (h *Hammer) ConfigureBIOS() error {

reboot, err := h.Hal.ConfigureBIOS()
if err != nil {
log.Warn("BIOS updates for this machine type are intentionally not supported, skipping ConfigureBIOS", "error", err)
return nil
return err
}
if reboot {
h.EventEmitter.Emit(event.ProvisioningEventPlannedReboot, "update BIOS configuration, need to reboot")
log.Info("bios", "message", "successfully configured BIOS")

log.Info("bios", "message", "updated BIOS configuration, reboot in 1 sec")
if reboot {
msg := "BIOS configuration requires a reboot"
h.EventEmitter.Emit(event.ProvisioningEventPlannedReboot, msg)
log.Info("bios", msg, "reboot in 1 sec")
time.Sleep(1 * time.Second)
err = kernel.Reboot()
if err != nil {
log.Error("reboot", "error", err)
return err
}
}

Expand All @@ -45,7 +46,7 @@ func (h *Hammer) EnsureBootOrder(bootloaderID string) error {
if err != nil {
return err
}
log.Info("bios", "message", "boot order ensured")
log.Info("bios", "message", "successfully ensured boot order")

return nil
}
12 changes: 2 additions & 10 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func Run(spec *Specification, hal hal.InBand) (*event.EventEmitter, error) {

err = hammer.ConfigureBIOS()
if err != nil {
log.Error("failed to update BIOS", "error", err)
log.Error("failed to configure BIOS", "error", err)
return eventEmitter, err
}

Expand Down Expand Up @@ -278,15 +278,7 @@ func (h *Hammer) installImage(eventEmitter *event.EventEmitter, m *models.Models

err = rep.ReportInstallation()
if err != nil {
wait := 10 * time.Second
log.Error("report installation failed", "reboot in", wait, "error", err)
time.Sleep(wait)
if !h.Spec.DevMode {
err = kernel.Reboot()
if err != nil {
log.Error("reboot", "error", err)
}
}
return err
}

log.Info("installation", "took", time.Since(installationStart))
Expand Down

0 comments on commit 76e9e31

Please sign in to comment.