Page MenuHomePhabricator

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

aheil created this task.Oct 10 2018, 2:12 PM
syncer assigned this task to dmbaturin.Oct 10 2018, 2:15 PM
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.
aheil added a comment.Oct 10 2018, 3:01 PM

turns out the script gets called with following argv:

['/usr/libexec/vyos/op_mode/show_dhcp.py', '--statistics', '--pool', 'statistics']
dmbaturin closed this task as Resolved.Oct 14 2018, 2:12 PM
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.

aheil added a comment.Oct 15 2018, 8:27 AM

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