KEAME leases python script
name: Bug report
about: Create a report to help us improve
If you believe your bug report is a security issue (e.g. a packet that can kill the server), DO NOT REPORT IT HERE. Please use https://www.isc.org/community/report-bug/ instead or send mail to security-office(at)isc(dot)org. If you really need to report it here, please set the confidential field to true.
Describe the bug dhcp2kea.py doesn't support ISC DHCP HA leases
To Reproduce Steps to reproduce the behavior:
Traceback (most recent call last): File "dhcp2kea.py", line 329, in print(leases,file=f) # writing File "dhcp2kea.py", line 98, in str max_life = (self.ver==4) and (v["ends"]-v["starts"]) or v["max-life"] KeyError: 'ends'
Expected behavior A clear and concise description of what you expected to happen: No errors reported.
Environment:
-
ISC DHCP version: 4.2.5
-
OS: CentOS 7
Additional Information Add any other context about the problem here. In particular, feel free to share your config file and logs from around the time error occurred. Don't be shy to send more logs than you think are relevant. It is easy to grep large log files. It is tricky to guess what may have happened without any information.
Make sure you anonymize your config files (at the very lease make sure you obfuscate your database credentials, but you may also replace your actual IP addresses and host names with example.com and 10.0.0.0/8 or 2001:db8::/32).
Some initial questions The script doesn't handle leases in the 'backup' state
Is your feature request related to a problem? Please describe. KEAME leases migration tool is not working with DHCP HA leases
Describe the solution you'd like
diff -u dhcp2kea.py dhcp2kea.py.ok
--- dhcp2kea.py 2023-10-22 07:42:53.735809274 -0700 +++ dhcp2kea.py.ok 2023-10-22 07:42:08.098860761 -0700 @@ -92,8 +92,8 @@ s = s4 if self.ver == 4 else s6 self.written = 0 for k,v in self.leases.items():
-
if "binding state" in v and v["binding state"].startswith("free"): # ticket #4
-
continue # skip free and backup leases
-
if "binding state" in v and (v["binding state"].startswith("free") or v["binding state"].startswith("backup")): # ticket #4
-
continue # skip free and backup leases self.written += 1 max_life = (self.ver==4) and (v["ends"]-v["starts"]) or v["max-life"] if "valid_lifetime" in v :
Describe alternatives you've considered I just modified the line 95 in the script
Additional context Add any other context about the feature request here.
Funding its development ISC DHCP is run by ISC, which is a small non-profit organization without any government funding or any permanent sponsorship organizations. Are you able and willing to participate financially in the development costs?
Participating in development Are you willing to participate in the feature development? ISC team always tries to make a feature as generic as possible, so it can be used in wide variety of situations. That means the proposed solution may be a bit different that you initially thought. Are you willing to take part in the design discussions? Are you willing to test an unreleased engineering code?
Contacting you How can ISC reach you to discuss this matter further? If you do not specify any means such as e-mail, jabber id or a telephone, we may send you a message on github with questions when we have them.