← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~julian-edwards/maas/broken-leases-parser-bug-1042047 into lp:maas

 

Julian Edwards has proposed merging lp:~julian-edwards/maas/broken-leases-parser-bug-1042047 into lp:maas.

Requested reviews:
  MAAS Maintainers (maas-maintainers)
Related bugs:
  Bug #1042047 in MAAS: "leases parser doesn't work"
  https://bugs.launchpad.net/maas/+bug/1042047

For more details, see:
https://code.launchpad.net/~julian-edwards/maas/broken-leases-parser-bug-1042047/+merge/121542

Add a bunch more lease statements to ignore in the lease parser, as found in the dhcpd.leases man page.
-- 
https://code.launchpad.net/~julian-edwards/maas/broken-leases-parser-bug-1042047/+merge/121542
Your team MAAS Maintainers is requested to review the proposed merge of lp:~julian-edwards/maas/broken-leases-parser-bug-1042047 into lp:maas.
=== modified file 'src/provisioningserver/dhcp/leases_parser.py'
--- src/provisioningserver/dhcp/leases_parser.py	2012-08-27 09:02:06 +0000
+++ src/provisioningserver/dhcp/leases_parser.py	2012-08-28 06:43:21 +0000
@@ -51,12 +51,18 @@
 ends = CaselessKeyword("ends") + expiry("expiry")
 other_statement = (
     oneOf(
-        ['starts', 'tstp', 'tsfp', 'cltt', 'uid', 'binding', 'next'],
+        ['starts', 'tstp', 'atsfp', 'tsfp', 'cltt', 'uid', 'binding', 'next',
+         'client-hostname', 'abandoned', 'option', 'ddns-text',
+         'ddns-fwd-name', 'ddns-client-fqdn', 'ddns-rev-name',
+         'vendor-class-identifier', 'bootp', 'reserved'],
         caseless=True) + args
     )
+lone_statement = (
+    oneOf(['abandoned', 'bootp', 'reserved'], caseless=True))
 
 lease_statement = (
-    hardware | ends | set_statement | other_statement) + Suppress(';')
+    hardware | ends | set_statement | lone_statement | other_statement
+    ) + Suppress(';')
 lease_parser = (
     CaselessKeyword("lease") + ip("ip") +
     Suppress('{') +

=== modified file 'src/provisioningserver/dhcp/tests/test_leases_parser.py'
--- src/provisioningserver/dhcp/tests/test_leases_parser.py	2012-08-27 05:07:02 +0000
+++ src/provisioningserver/dhcp/tests/test_leases_parser.py	2012-08-28 06:43:21 +0000
@@ -79,12 +79,24 @@
                 ends never;
                 tstp 6 2010/01/02 05:00:00;
                 tsfp 6 2010/01/02 05:00:00;
+                atsfp 6 2010/01/02 05:00:00;
                 cltt 1 2010/01/02 05:00:00;
                 binding state free;
                 next binding state free;
                 hardware ethernet %(mac)s;
                 uid "\001\000\234\002\242\2020";
                 set vendorclass = "PXEClient:Arch:00000:UNDI:002001";
+                client-hostname foo;
+                abandoned;
+                option agent.circuit-id thing;
+                option agent.remote-id thing;
+                ddns-text foo;
+                ddns-fwd-name foo;
+                ddns-client-fqdn foo;
+                ddns-rev-name foo;
+                vendor-class-identifier foo;
+                bootp;
+                reserved;
             }
             """ % params))
         self.assertEqual({params['ip']: params['mac']}, leases)