# HG changeset patch # User Tero Marttila # Date 1425248379 -7200 # Node ID f1335a4301d07587eaf1006545ba27d056405e76 # Parent a5b712cd027360a8c20fca68b234cf3d89a5f49b pvl.dhcp.config: loosen up TOKEN even further to permit unquoted IP addresses and ethernet addresses diff -r a5b712cd0273 -r f1335a4301d0 pvl/dhcp/config.py --- a/pvl/dhcp/config.py Mon Mar 02 00:15:17 2015 +0200 +++ b/pvl/dhcp/config.py Mon Mar 02 00:19:39 2015 +0200 @@ -3,8 +3,7 @@ import string # simplified model of lexer chars -TOKEN_START = string.ascii_letters -TOKEN = TOKEN_START + string.digits + '-_.' +TOKEN = string.ascii_letters + string.digits + '-_.:' class DHCPConfigError(Exception): def __init__ (self, parser, error, line=None): @@ -76,9 +75,7 @@ if isinstance(value, int): return str(value) - elif not value: - return '' - elif value[0] in TOKEN_START and all(c in TOKEN for c in value): + elif all(c in TOKEN for c in value): return str(value) else: # quoted diff -r a5b712cd0273 -r f1335a4301d0 pvl/dhcp/tests.py --- a/pvl/dhcp/tests.py Mon Mar 02 00:15:17 2015 +0200 +++ b/pvl/dhcp/tests.py Mon Mar 02 00:19:39 2015 +0200 @@ -85,10 +85,20 @@ filename "/debian/wheezy/pxelinux.0"; include "hosts/test.conf"; + + host test { + fixed-address 192.0.2.1; + hardware ethernet 00:11:22:33:44:55; + } } """)), (('group', ), [ ('next-server', 'boot.test'), ('filename', "/debian/wheezy/pxelinux.0"), ('include', "hosts/test.conf"), - ], [])) + ], [ + (('host', 'test'), [ + ('fixed-address', '192.0.2.1'), + ('hardware', 'ethernet', '00:11:22:33:44:55'), + ], []) + ]))