diff options
author | Daniil Baturin <daniil@baturin.org> | 2018-10-28 18:58:51 +0100 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2018-10-28 18:58:51 +0100 |
commit | 50186e6d7f33b4cc5300eba6b9381e2a2528d8b4 (patch) | |
tree | 05032cedbe5a2beb67dd10c0493cff400b936bc1 /src/op_mode | |
parent | ba8af69a619362d28ffcd45b6f0f042b743f38f4 (diff) | |
parent | 2b8d48bcd77134dff741158c81f7fadf3183e280 (diff) | |
download | vyos-1x-50186e6d7f33b4cc5300eba6b9381e2a2528d8b4.tar.gz vyos-1x-50186e6d7f33b4cc5300eba6b9381e2a2528d8b4.zip |
Merge branch 'current' into crux
Diffstat (limited to 'src/op_mode')
-rwxr-xr-x | src/op_mode/show_dhcp.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/op_mode/show_dhcp.py b/src/op_mode/show_dhcp.py index e76fc3a14..0005d62a3 100755 --- a/src/op_mode/show_dhcp.py +++ b/src/op_mode/show_dhcp.py @@ -142,7 +142,12 @@ if __name__ == '__main__': for p in pools: size = get_pool_size(config, p) leases = len(get_leases(lease_file, state='active', pool=args.pool)) - use_percentage = round(leases / size) * 100 + + if size != 0: + use_percentage = round(leases / size) * 100 + else: + use_percentage = 0 + if args.json: pool_stats = {"pool": p, "size": size, "leases": leases, "available": (size - leases), "percentage": use_percentage} |