Page MenuHomeVyOS Platform

ZeroDivisionError in show_dhcp.py if number of leases is 0
Closed, ResolvedPublicBUG

Description

doing a a sh dhcp server statistics pool LAN is giving following error:

vyos@gw2-mi:~$ sh dhcp server statistics pool LAN
Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/show_dhcp.py", line 145, in <module>
    use_percentage = round(leases / size) * 100
ZeroDivisionError: division by zero

Details

Difficulty level
Easy (less than an hour)
Version
1.2.0-rc2
Why the issue appeared?
Will be filled on close

Event Timeline

syncer triaged this task as Normal priority.
syncer edited projects, added VyOS 1.2 Crux (VyOS 1.2.0-rc2); removed VyOS 1.2 Crux.

turns out the script gets called with following argv:

['/usr/libexec/vyos/op_mode/show_dhcp.py', '--statistics', '--pool', 'statistics']
dmbaturin moved this task from Needs Triage to Finished on the VyOS 1.2 Crux (VyOS 1.2.0-rc3) board.

Pretty silly mistake on my part indeed. I've merged the pull request.

this does not fix the second part. But maybe that should be a seperate Bug...