Skip to content

Commit

Permalink
check whether a network was found
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBurger committed Oct 17, 2024
1 parent ae74b9f commit 5e1f378
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/controller/infrastructure/infraflow/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,17 @@ func (fctx *FlowContext) ensureNetwork(ctx context.Context) error {
}

func (fctx *FlowContext) ensureConfiguredNetwork(_ context.Context) error {
network, err := fctx.access.GetNetworkByID(*fctx.config.Networks.ID)
networkId := *fctx.config.Networks.ID
network, err := fctx.access.GetNetworkByID(networkId)
if err != nil {
fctx.state.Set(IdentifierNetwork, "")
fctx.state.Set(NameNetwork, "")
return err
}
fctx.state.Set(IdentifierNetwork, *fctx.config.Networks.ID)
if network == nil {
return fmt.Errorf("network with ID '%s' not found", networkId)
}
fctx.state.Set(IdentifierNetwork, networkId)
fctx.state.Set(NameNetwork, network.Name)
return nil
}
Expand Down

0 comments on commit 5e1f378

Please sign in to comment.