mirror of
https://github.com/siderolabs/talos.git
synced 2025-08-24 16:11:11 +02:00
fix(machined): add nil checks to metal initializer
Check that the userdata has an Install section before trying to use it Fixes #1186 Signed-off-by: Seán C McCord <ulexus@gmail.com>
This commit is contained in:
parent
6efd6fbe08
commit
1a64ece04f
@ -5,6 +5,7 @@
|
||||
package metal
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@ -25,6 +26,12 @@ type Metal struct{}
|
||||
|
||||
// Initialize implements the Initializer interface.
|
||||
func (b *Metal) Initialize(platform platform.Platform, data *userdata.UserData) (err error) {
|
||||
if data == nil {
|
||||
return errors.New("no userdata")
|
||||
}
|
||||
if data.Install == nil {
|
||||
return errors.New("userdata has no install section")
|
||||
}
|
||||
// Attempt to discover a previous installation
|
||||
// An err case should only happen if no partitions
|
||||
// with matching labels were found
|
||||
|
Loading…
x
Reference in New Issue
Block a user