mirror of
https://github.com/siderolabs/talos.git
synced 2025-10-03 11:41:10 +02:00
fix: validate IP address returned as HTTP response in platform code
If provider returns empty response, it is parsed as `nil` IP address and included in the response which leads to `<nil>` entries in the machine configuration after applying dynamic config. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
This commit is contained in:
parent
c9af8f7ff1
commit
80b5f0e7f7
@ -202,7 +202,9 @@ func (a *AWS) ExternalIPs(ctx context.Context) (addrs []net.IP, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
addrs = append(addrs, net.ParseIP(string(body)))
|
||||
if addr := net.ParseIP(string(body)); addr != nil {
|
||||
addrs = append(addrs, addr)
|
||||
}
|
||||
|
||||
return addrs, err
|
||||
}
|
||||
|
@ -99,7 +99,9 @@ func (d *DigitalOcean) ExternalIPs(ctx context.Context) (addrs []net.IP, err err
|
||||
return
|
||||
}
|
||||
|
||||
addrs = append(addrs, net.ParseIP(string(body)))
|
||||
if addr := net.ParseIP(string(body)); addr != nil {
|
||||
addrs = append(addrs, addr)
|
||||
}
|
||||
|
||||
return addrs, err
|
||||
}
|
||||
|
@ -101,7 +101,9 @@ func (a *Openstack) ExternalIPs(ctx context.Context) (addrs []net.IP, err error)
|
||||
return
|
||||
}
|
||||
|
||||
addrs = append(addrs, net.ParseIP(string(body)))
|
||||
if addr := net.ParseIP(string(body)); addr != nil {
|
||||
addrs = append(addrs, addr)
|
||||
}
|
||||
|
||||
return addrs, err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user