mini_buildd.cli module

mini_buildd.cli.LOG_FORMAT = '%(levelname).1s: %(message)s'

Generic log format

mini_buildd.cli.LOG_LEVELS = {'CRITICAL': '2', 'DEBUG': '7', 'ERROR': '3', 'INFO': '6', 'WARNING': '4'}

Log levels that we use throughout the code (python defaults), mapped to numerical counterparts used in syslog/systemd

mini_buildd.cli.log_test()

For debugging only

mini_buildd.cli.log_clone(dst, level=None, src='mini_buildd')

Set up logger named ‘dst’ with the same handlers and loglevel as the logger named ‘src’.

class mini_buildd.cli.ConsoleHandler

Bases: StreamHandler

class mini_buildd.cli.ConsoleSystemDHandler

Bases: ConsoleHandler

emit(record)

Emit a record.

If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended to the stream. If the stream has an ‘encoding’ attribute, it is used to determine how to do the output to the stream.

class mini_buildd.cli.DaemonLogHandler

Bases: RotatingFileHandler

class mini_buildd.cli.DputCf(config='~/.dput.cf')

Bases: object

Guess possible mini-buildd targets and their URL endpoints.

first_target()
target_completer(**_kwargs)
first_http_url()
http_url_completer(**_kwargs)
get_target_ftp_url(target)
get_target_http_url(target)
class mini_buildd.cli.ArgumentDefaultsRawTextHelpFormatter(prog, indent_increment=2, max_help_position=24, width=None)

Bases: RawTextHelpFormatter, ArgumentDefaultsHelpFormatter

Custom argparse (for mini-buildd[-tool]) help formatter (mixin): We like to use raw text, but also have default values shown.

class mini_buildd.cli.CLI(prog, description, epilog=None, allow_unknown=False)

Bases: object

classmethod loggers()

Overwrite this method for custom subset of handler classes from this module.

setup()
abstract runcli()
run()
mini_buildd.cli.auth_log(msg)

Uff. Dirty hack to get an ‘auth’ log including the ssh fingerprint.

Needed (for now) by m-b-ssh-uploader-command, m-b-ssh-client-command.

Needs sshd on loglevel=VERBOSE, and the user needs access to auth.log (i.e., add user to group ‘adm’ in standard Debian).