unioslo/mreg-cli

Trying to use `dhcp assoc` on a host without an IP causes an indexerror.

Closed this issue · 0 comments

mreg> dhcp assoc foo mac
Traceback (most recent call last):
  File "/usr/bin/mreg-cli", line 33, in <module>
    sys.exit(load_entry_point('mreg-cli==0.0.0', 'console_scripts', 'mreg-cli')())
  File "/usr/lib/python3.9/site-packages/mreg_cli/main.py", line 187, in main
    cli.parse(shlex.split(line))
  File "/usr/lib/python3.9/site-packages/mreg_cli/cli.py", line 122, in parse
    args.func(args)
  File "/usr/lib/python3.9/site-packages/mreg_cli/dhcp.py", line 87, in assoc
    ip = _dhcp_get_ip_by_arg(args.name)
  File "/usr/lib/python3.9/site-packages/mreg_cli/dhcp.py", line 39, in _dhcp_get_ip_by_arg
    ip = info["ipaddresses"][0]
IndexError: list index out of range