As a show() companion, new get() commands are added to get the information
about a single DHCP parameter or host.
raise HostNotFoundError(name)
del self.hosts[name]
raise HostNotFoundError(name)
del self.hosts[name]
+ @handler
+ def get(self, name):
+ r"""get(name) -> CSV string :: List all the information of a host.
+
+ The host is returned as a CSV list of: hostname,ip,mac
+ """
+ if not name in self.hosts:
+ raise HostNotFoundError(name)
+ h = self.hosts[name]
+ return '%s,%s,%s' % (h.name, h.ip, h.mac)
+
@handler
def list(self):
r"""list() -> CSV string :: List all the hostnames.
@handler
def list(self):
r"""list() -> CSV string :: List all the hostnames.
raise ParameterNotFoundError(param)
self.vars[param] = value
raise ParameterNotFoundError(param)
self.vars[param] = value
+ @handler
+ def get(self, param):
+ r"get(param) -> None :: Get a DHCP parameter."
+ if not param in self.vars:
+ raise ParameterNotFoundError(param)
+ return self.vars[param]
+
@handler
def list(self):
r"""list() -> CSV string :: List all the parameter names.
@handler
def list(self):
r"""list() -> CSV string :: List all the parameter names.