]> git.proxmox.com Git - pmg-api.git/commit
prefer more flexible get_local_ip where possible
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 18 Sep 2021 13:06:57 +0000 (15:06 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 18 Sep 2021 13:07:03 +0000 (15:07 +0200)
commit687cb0ef9ca1260f3a3c68bcc5bb1105a5729ec1
tree2d4c49ed0c2d393246b38b63c2c92b93fc02b203
parent239ef32a83e1b025e0da88fb412b0a0cab7ebeb7
prefer more flexible get_local_ip where possible

get_ip_from_hostname does only check getaddrinfo, which can fail for
the local node in some environments, especially container ones.

Rather, use the new get_local_ip helper, that still tries to do a gai
call first, but falls back to configured (/etc/network/interfaces)
IPs and also on the currently, from kernel POV active ones.

A big bonus is that the new helper is much less likely to die, so it
won't break service startup in restricted (CTs) envs after initial
setup as often anymore.

While yes, if no addr is resolved, configured or active the PMG won't
work, but killing pmg proxy/daemon won't better that situation either
;)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
debian/control
src/PMG/Cluster.pm
src/PMG/ClusterConfig.pm