mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-30 03:21:59 +00:00
python: Fix lxc-ls's usage of get_ips()
The recent port of get_ips() from pure python to the C API came with a couple of API changes for that function call (as were highlighted in the commit message). I somehow didn't notice that lxc-ls was still calling with the old API and so was crashing whenever it was asked to show the ipv4 or ipv6 address. Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
parent
5bb4a226eb
commit
ad5f151515
@ -202,10 +202,10 @@ for container_name in lxc.list_containers(config_path=lxcpath):
|
|||||||
entry['pid'] = str(container.init_pid)
|
entry['pid'] = str(container.init_pid)
|
||||||
|
|
||||||
# Get the IPs
|
# Get the IPs
|
||||||
for protocol in ('ipv4', 'ipv6'):
|
for family, protocol in {'inet': 'ipv4', 'inet6': 'ipv6'}.items():
|
||||||
if protocol in args.fancy_format or args.nesting:
|
if protocol in args.fancy_format or args.nesting:
|
||||||
entry[protocol] = "-"
|
entry[protocol] = "-"
|
||||||
ips = container.get_ips(protocol=protocol, timeout=1)
|
ips = container.get_ips(family=family)
|
||||||
if ips:
|
if ips:
|
||||||
entry[protocol] = ", ".join(ips)
|
entry[protocol] = ", ".join(ips)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user