Skip to content

Commit

Permalink
Validate DHCP network id (#1714)
Browse files Browse the repository at this point in the history
* Revert "Use uncached client (#1682)"

This reverts commit aa44df2.

* Explicitly set GVK for IBMPowerVSCluster object

* Validate Network ID for nil before dereferencing
  • Loading branch information
Karthik-K-N committed Apr 8, 2024
1 parent fe442aa commit 1cad73b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cloud/scope/powervs_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,10 @@ func (m *PowerVSMachineScope) SetAddresses(instance *models.PVMInstance) { //nol
// Get the Details of DHCP server associated with the network
var dhcpServerDetails *models.DHCPServerDetail
for _, server := range dhcpServer {
if server.Network == nil || server.Network.ID == nil {
m.V(3).Info("Skipping the DHCP server as its network details is nil", "DHCP server", *server.ID)
continue
}
if *server.Network.ID == *networkID {
m.Info("found DHCP server for network", "DHCP server ID", *server.ID, "network ID", *networkID)
dhcpServerDetails, err = m.IBMPowerVSClient.GetDHCPServer(*server.ID)
Expand Down

0 comments on commit 1cad73b

Please sign in to comment.