Closed psychomario closed 9 years ago
@psychomario looks like you didn't use pickle
? Also, this looks good but I just wanted to point out the variable and function naming should maybe be more inline with PEP8 (def export_leases
rather than def exportLeases
).
I don't really like pickle
, it leaves a completely opaque binary file on disk, it would have worked significantly better for storing the binary data from options
, but given that I've moved that elsewhere it isn't an issue anymore.. This method leaves a nice json file which, for whatever reason, is editable and viewable.
I've pushed a new commit with the style improvements you suggested.
@psychomario sorry to be a pest but I made a few line comment where variable names should still be modified to conform with PEP8. Give it a look once more? Thanks.
As ever, you're correct. I'm not able to make these changes for the next few days but I will do so when I can.
@psychomario since #111 was just merged you're going to need to do a rebase anyway lol
@mmattioli I think I've got all your changes, I almost made a mess of the branch in the process.
:+1: LGTM
Handles
SIG{INT,ALRM,TERM,HUP}
to dump out the leases object to--saveleases
file as json. On start with--saveleases
theself.leases
object is updated with the contents, so non-expired(BUG we don't check, will fix)(fixed in 2936162) leases are usedThe keys are translated to human readable (and json compatible) mac addresses on export, and back on import.
I've also moved
self.leases[client_mac]['options']
to a separate object. It means we don't have to clean up theself.leases
dict every time we save it.