nobodd.server
This module contains the server and handler classes which make up the main nobodd-tftpd application, as well as the entry point for the application itself.
Handler Classes
- class nobodd.server.BootHandler(request, client_address, server)[source]
A descendent of
TFTPBaseHandler
that resolves paths relative to the FAT file-system in the OS image associated with the Pi serial number which forms the initial directory.- resolve_path(filename)[source]
Resolves filename relative to the OS image associated with the initial directory.
In other words, if the request is for
1234abcd/config.txt
, the handler will look up the board with serial number1234abcd
inBootServer.boards
, find the associated OS image, the FAT file-system within that image, and resolveconfig.txt
within that file-system.
Server Classes
- class nobodd.server.BootServer(server_address, boards)[source]
A descendent of
TFTPBaseServer
that is configured with boards, a mapping of Pi serial numbers toBoard
instances, and usesBootHandler
as the handler class.
Application Functions
- nobodd.server.main(args=None)[source]
The main entry point for the nobodd-tftpd application. Takes args, the sequence of command line arguments to parse. Returns the exit code of the application (0 for a normal exit, and non-zero otherwise).
If
DEBUG=1
is found in the application’s environment, top-level exceptions will be printed with a full back-trace.DEBUG=2
will launch PDB in port-mortem mode.
- nobodd.server.request_loop(server_address, boards)[source]
The application’s request loop. Takes the server_address to bind to, which may be a
(address, port)
tuple, or anint
file-descriptor passed by a service manager, and the boards configuration, adict
mapping serial numbers toBoard
instances.Raises
ReloadRequest
orTerminateRequest
in response to certain signals, but is an infinite loop otherwise.
- nobodd.server.get_parser()[source]
Returns the command line parser for the application, pre-configured with defaults from the application’s configuration file(s). See
ConfigArgumentParser()
for more information.
Exceptions
- exception nobodd.server.ReloadRequest[source]
Exception class raised in
request_loop()
to cause a reload. Handled inmain()
.
- exception nobodd.server.TerminateRequest(returncode, message='')[source]
Exception class raised in
request_loop()
to cause service termination. Handled inmain()
. Takes the return code of the application as the first argument.