fix: only set gateway if set in context (opennebula)

Fix the network config setup.

Signed-off-by: Christian WALDBILLIG <christian@waldbillig.io>
Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This commit is contained in:
Christian WALDBILLIG 2024-02-22 23:52:32 +01:00 committed by Andrey Smirnov
parent 4575dd8e74
commit c79d69c2e2
No known key found for this signature in database
GPG Key ID: FE042E3D4085A811

View File

@ -127,6 +127,7 @@ func (o *OpenNebula) ParseMetadata(st state.State, oneContextPlain []byte) (*run
},
)
if oneContext[ifaceName+"_GATEWAY"] != "" {
// Parse gateway address and create RouteSpecSpec entry
gateway, err := netip.ParseAddr(oneContext[ifaceName+"_GATEWAY"])
if err != nil {
@ -147,6 +148,7 @@ func (o *OpenNebula) ParseMetadata(st state.State, oneContextPlain []byte) (*run
route.Normalize()
networkConfig.Routes = append(networkConfig.Routes, route)
}
// Parse DNS servers
dnsServers := strings.Fields(oneContext[ifaceName+"_DNS"])