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 number 1234abcd in BootServer.boards, find the associated OS image, the FAT file-system within that image, and resolve config.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 to Board instances, and uses BootHandler as the handler class.

boards

The mapping of Pi serial numbers to Board instances.

server_close()[source]

Called to clean-up the server.

May be overridden.

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 an int file-descriptor passed by a service manager, and the boards configuration, a dict mapping serial numbers to Board instances.

Raises ReloadRequest or TerminateRequest 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 in main().

exception nobodd.server.TerminateRequest(returncode, message='')[source]

Exception class raised in request_loop() to cause service termination. Handled in main(). Takes the return code of the application as the first argument.