mirror of
https://github.com/siderolabs/talos.git
synced 2025-12-07 18:41:33 +01:00
fix: don't panic if the machine config doesn't have network (EM)
This handles the case if the machine config doesn't contain `.machine.network` (I got hit by that today). Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
This commit is contained in:
parent
8bef41e4ba
commit
0b86edab80
@ -76,7 +76,7 @@ func (p *Packet) Name() string {
|
||||
}
|
||||
|
||||
// Configuration implements the platform.Platform interface.
|
||||
//nolint:gocyclo
|
||||
//nolint:gocyclo,cyclop
|
||||
func (p *Packet) Configuration(ctx context.Context) ([]byte, error) {
|
||||
// Fetch and unmarshal both the talos machine config and the
|
||||
// metadata about the instance from packet's metadata server
|
||||
@ -199,6 +199,14 @@ func (p *Packet) Configuration(ctx context.Context) ([]byte, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if machineConfig.MachineConfig == nil {
|
||||
machineConfig.MachineConfig = &v1alpha1.MachineConfig{}
|
||||
}
|
||||
|
||||
if machineConfig.MachineConfig.MachineNetwork == nil {
|
||||
machineConfig.MachineConfig.MachineNetwork = &v1alpha1.NetworkConfig{}
|
||||
}
|
||||
|
||||
machineConfig.MachineConfig.MachineNetwork.NetworkInterfaces = append(
|
||||
machineConfig.MachineConfig.MachineNetwork.NetworkInterfaces,
|
||||
&bondDev,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user