Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract leases - Binding state backup #20

Closed
ghost opened this issue Oct 17, 2017 · 11 comments
Closed

Extract leases - Binding state backup #20

ghost opened this issue Oct 17, 2017 · 11 comments

Comments

@ghost
Copy link

ghost commented Oct 17, 2017

Hello,

My problem is the following:
I can't extract from the leases.get (), the leases whose binding state is backup and of which there is no end.

I can :

lease **** {
  starts 4 2017/10/05 15:22:29;
  ends 1 2017/10/16 08:09:23;
  tstp 1 2017/10/16 15:22:29;
  tsfp 1 2017/10/16 15:22:29;
  atsfp 1 2017/10/16 15:22:29;
  cltt 4 2017/10/05 15:22:29;
  binding state backup;
  hardware ethernet *****;
  uid *****;

I can"t :

lease ******* {
  starts 2 2017/10/10 12:05:14;
  tstp 2 2017/10/10 12:05:14;
  tsfp 2 2017/10/10 12:05:14;
  atsfp 2 2017/10/10 12:05:14;
  binding state backup;

Is there a solution ?

Regards,

@MartijnBraam
Copy link
Owner

Well it should ignore incomplete leases since those aren't valid. I'll check why your backup lease won't work.

@ghost
Copy link
Author

ghost commented Oct 18, 2017

So in fact, this lease does not appear in the list of leases.get() because it lacks the "ends" ?

@MartijnBraam
Copy link
Owner

Oh I thought you meant end as in "missing the }". Leases without end should work.

@MartijnBraam
Copy link
Owner

MartijnBraam commented Oct 18, 2017

I've added testcases for both your leases and it seems to work fine. You can see my lease file here: https://github.com/MartijnBraam/python-isc-dhcp-leases/pull/21/files

Maybe you have something different in your lease file that makes it stop working?

@ghost
Copy link
Author

ghost commented Oct 18, 2017

In fact, as the lease is backup it has never been used, there is not the line "hardware ethernet ***" and I think the problem is there

@ghost
Copy link
Author

ghost commented Oct 18, 2017

It would be necessary that the code accepts that the lease does not have ends and harware

@MartijnBraam
Copy link
Owner

The current version does support leases without ends but skips leases without hardware. In #21 I've added a option to the get() method to allow you to get hardware-less leases.

Can you try if that version works if you specify get(include_backups=True)?

@ghost
Copy link
Author

ghost commented Oct 18, 2017

Thank you ! It works very well in case there is no hardware but I still have the following error if I do not have any ends

line 209, in __init__
    if properties['ends'] == 'never':
KeyError: 'ends'

@MartijnBraam
Copy link
Owner

Hmm that line doesn't exist in the current codebase. Are you using an older version?

@ghost
Copy link
Author

ghost commented Oct 18, 2017

This corresponded to line 213 in the most recent version. I missed get('ends', 'never'), it's works now !

@MartijnBraam
Copy link
Owner

I've just released 0.9.0 on pypi with the fixes for this included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant