Skip to content

Commit

Permalink
handle nil network id in dhcp detail
Browse files Browse the repository at this point in the history
Fixes IBM-Cloud#4683

Signed-off-by: Yussuf Shaikh <yussuf.shaikh1@ibm.com>
  • Loading branch information
yussufsh authored and benbuchanan committed Aug 17, 2023
1 parent 2cfd566 commit 86649ea
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
10 changes: 7 additions & 3 deletions ibm/service/power/data_source_ibm_pi_dhcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,13 @@ func dataSourceIBMPIDhcpRead(ctx context.Context, d *schema.ResourceData, meta i

if dhcpServer.Network != nil {
dhcpNetwork := dhcpServer.Network
d.Set(Attr_DhcpNetworkDeprecated, *dhcpNetwork.ID)
d.Set(Attr_DhcpNetworkID, *dhcpNetwork.ID)
d.Set(Attr_DhcpNetworkName, *dhcpNetwork.Name)
if dhcpNetwork.ID != nil {
d.Set(Attr_DhcpNetworkDeprecated, *dhcpNetwork.ID)
d.Set(Attr_DhcpNetworkID, *dhcpNetwork.ID)
}
if dhcpNetwork.Name != nil {
d.Set(Attr_DhcpNetworkName, *dhcpNetwork.Name)
}
}

if dhcpServer.Leases != nil {
Expand Down
10 changes: 7 additions & 3 deletions ibm/service/power/data_source_ibm_pi_dhcps.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,13 @@ func dataSourceIBMPIDhcpServersRead(ctx context.Context, d *schema.ResourceData,
}
if dhcpServer.Network != nil {
dhcpNetwork := dhcpServer.Network
server[Attr_DhcpNetworkDeprecated] = *dhcpNetwork.ID
server[Attr_DhcpNetworkID] = *dhcpNetwork.ID
server[Attr_DhcpNetworkName] = *dhcpNetwork.Name
if dhcpNetwork.ID != nil {
d.Set(Attr_DhcpNetworkDeprecated, *dhcpNetwork.ID)
d.Set(Attr_DhcpNetworkID, *dhcpNetwork.ID)
}
if dhcpNetwork.Name != nil {
d.Set(Attr_DhcpNetworkName, *dhcpNetwork.Name)
}
}
servers = append(servers, server)
}
Expand Down
10 changes: 7 additions & 3 deletions ibm/service/power/resource_ibm_pi_dhcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,13 @@ func resourceIBMPIDhcpRead(ctx context.Context, d *schema.ResourceData, meta int

if dhcpServer.Network != nil {
dhcpNetwork := dhcpServer.Network
d.Set(Attr_DhcpNetworkDeprecated, *dhcpNetwork.ID)
d.Set(Attr_DhcpNetworkID, *dhcpNetwork.ID)
d.Set(Attr_DhcpNetworkName, *dhcpNetwork.Name)
if dhcpNetwork.ID != nil {
d.Set(Attr_DhcpNetworkDeprecated, *dhcpNetwork.ID)
d.Set(Attr_DhcpNetworkID, *dhcpNetwork.ID)
}
if dhcpNetwork.Name != nil {
d.Set(Attr_DhcpNetworkName, *dhcpNetwork.Name)
}
}

if dhcpServer.Leases != nil {
Expand Down

0 comments on commit 86649ea

Please sign in to comment.