--- a/dhcp.py Thu Apr 02 21:11:01 2009 +0300
+++ b/dhcp.py Thu Apr 02 22:52:26 2009 +0300
@@ -10,7 +10,7 @@
"""
def __init__ (self, name=dhcpc.ConfFile.DEFAULT_NAME, path=dhcpc.ConfFile.DEFAULT_PATH,
- settings=None, options=None, shared_network=False, subnets=None, hosts=None
+ settings=None, options=None, shared_network=False, subnets=None, hosts=None, comment=None
) :
"""
Create a full configuration file for the given settings:
@@ -23,7 +23,7 @@
"""
- dhcpc.ConfFile.__init__(self, name, path)
+ dhcpc.ConfFile.__init__(self, name, path, comment=comment)
# define global settings
if settings :
@@ -49,7 +49,7 @@
A subnet declaration with a router, and optionally a dynamic address pool, and allow/deny unknown clients
"""
- def __init__ (self, subnet, router_idx=1, range=None, unknown_clients=None) :
+ def __init__ (self, subnet, router_idx=1, range=None, unknown_clients=None, comment=None) :
"""
@param subnet the addr.IP representing the subnet
@param router_idx the subnet[index] of the default gateway
@@ -65,7 +65,7 @@
dhcpc.Option("routers", subnet[router_idx]),
dhcpc.Parameter("range", subnet[range[0]], subnet[range[1]]) if range else None,
dhcpc.Parameter(unknown_clients, "unknown-clients") if unknown_clients else None,
- ])
+ ], comment=comment)
class Host (dhcpc.Host) :
@@ -73,9 +73,9 @@
A host declaration with a hardware address and a IP address
"""
- def __init__ (self, hostname, mac_addr, ip_addr) :
+ def __init__ (self, hostname, mac_addr, ip_addr, comment=None) :
super(Host, self).__init__(hostname, params=[
dhcpc.Parameter("hardware ethernet", mac_addr),
dhcpc.Parameter("fixed-address", ip_addr)
- ])
+ ], comment=comment)