Skip to content

Commit

Permalink
🐛 Fix listing ironic node ports with empty mac address
Browse files Browse the repository at this point in the history
Signed-off-by: Zhiwei Huang <[email protected]>
  • Loading branch information
hex2dec committed Nov 28, 2024
1 parent be0db3b commit 8d0fe0c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/provisioner/ironic/ironic.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,15 @@ func (p *ironicProvisioner) validateNode(ironicNode *nodes.Node) (errorMessage s
func (p *ironicProvisioner) listAllPorts(address string) ([]ports.Port, error) {
var allPorts []ports.Port

opts := ports.ListOpts{
Fields: []string{"node_uuid"},
// Don't call the ironic api when the port mac address is empty.
if address == "" {
return allPorts, nil
}

if address != "" {
opts.Address = address
opts := ports.ListOpts{
Fields: []string{"node_uuid"},
Address: address,
}

pager := ports.List(p.client, opts)

allPages, err := pager.AllPages(p.ctx)
Expand Down

0 comments on commit 8d0fe0c

Please sign in to comment.