Skip to content

Commit

Permalink
Merge pull request #485 from twz123/fix-priv-addr-validation
Browse files Browse the repository at this point in the history
Don't count empty private addresses during validation
  • Loading branch information
twz123 committed Jun 6, 2023
2 parents 102ec99 + 7959d6e commit 5300b1c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions phase/validate_hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ func (p *ValidateHosts) Run() error {
for _, h := range p.Config.Spec.Hosts {
p.hncount[h.Metadata.Hostname]++
p.machineidcount[h.Metadata.MachineID]++
p.privateaddrcount[h.PrivateAddress]++
if h.PrivateAddress != "" {
p.privateaddrcount[h.PrivateAddress]++
}
}

return p.parallelDo(
Expand All @@ -50,7 +52,7 @@ func (p *ValidateHosts) validateUniqueHostname(h *cluster.Host) error {

func (p *ValidateHosts) validateUniquePrivateAddress(h *cluster.Host) error {
if p.privateaddrcount[h.PrivateAddress] > 1 {
return fmt.Errorf("privateAddress %s is not unique: %s", h.PrivateAddress, h.Metadata.Hostname)
return fmt.Errorf("privateAddress %q is not unique: %s", h.PrivateAddress, h.Metadata.Hostname)
}

return nil
Expand Down

0 comments on commit 5300b1c

Please sign in to comment.