Exceptions

class pybsd.exceptions.PyBSDError[source]

Bases: exceptions.Exception

Base PyBSD Exception. It is only used to except any PyBSD error and never raised

msg

str

The template used to generate the exception message

message

An alias of __str__, useful for tests

Network

class pybsd.exceptions.InterfaceError(environment, interface)[source]

Bases: pybsd.exceptions.PyBSDError

Base exception for errors involving a network interface.

Parameters:
  • environment (BaseSystem) – The environment on which the command is deployed. Any subclass of BaseSystem
  • interface (Interface) – The interface
class pybsd.exceptions.MissingMainIPError(environment, interface)[source]

Bases: pybsd.exceptions.InterfaceError

Error when a network interface doesn’t have at least one main ip.

Parameters:
  • environment (BaseSystem) – The environment to which the interface is attached. Any subclass of BaseSystem
  • interface (Interface) – The interface
class pybsd.exceptions.InvalidMainIPError(environment, interface, reason)[source]

Bases: pybsd.exceptions.InterfaceError

Error when ips are duplicated.

Parameters:
  • environment (BaseSystem) – The environment to which the interface is attached. Any subclass of BaseSystem
  • interface (Interface) – The interface
  • reason (str) – The reason why this main if is invalid
class pybsd.exceptions.DuplicateIPError(environment, interface, ips)[source]

Bases: pybsd.exceptions.InterfaceError

Error when ips are duplicated.

Parameters:
  • environment (BaseSystem) – The environment to which the interface is attached. Any subclass of BaseSystem
  • interface (Interface) – The interface
  • ips (set) – The ips

Commands

class pybsd.exceptions.BaseCommandError(command, environment)[source]

Bases: pybsd.exceptions.PyBSDError

Base exception for errors involving a command. It is never raised

Parameters:
  • command (Command) – The command
  • environment (BaseSystem) – The environment on which the command is deployed. Any subclass of BaseSystem
class pybsd.exceptions.InvalidCommandNameError(command, environment)[source]

Bases: pybsd.exceptions.BaseCommandError

Error when a command is missing a name attribute

Parameters:
class pybsd.exceptions.InvalidCommandExecutorError(command, environment)[source]

Bases: pybsd.exceptions.BaseCommandError

Error when a command is missing a name attribute

Parameters:command (BaseCommand) – The command
class pybsd.exceptions.CommandNotImplementedError(command, environment)[source]

Bases: pybsd.exceptions.BaseCommandError

Error when a command is missing a name attribute

Parameters:
class pybsd.exceptions.CommandConnectionError(command, environment)[source]

Bases: pybsd.exceptions.BaseCommandError

Error when a command is missing a name attribute

Parameters:
class pybsd.exceptions.CommandError(command, environment, subcommand=None)[source]

Bases: pybsd.exceptions.BaseCommandError

Base exception for errors involving a validated command. It is never raised

Parameters:
  • command (BaseCommand) – The command
  • environment (BaseSystem) – The environment on which the command is deployed. Any subclass of BaseSystem
  • subcommand (str) – The subcommand, if any
class pybsd.exceptions.WhitespaceError(command, environment, argument, value, subcommand=None)[source]

Bases: pybsd.exceptions.CommandError

Error when a command arguments include corrupting whitespace

Parameters:
  • command (BaseCommand) – The command
  • environment (BaseSystem) – The environment on which the command is executed. Any subclass of BaseSystem
  • subcommand (str) – The subcommand, if any
class pybsd.exceptions.InvalidOutputError(command, environment, err, subcommand=None)[source]

Bases: pybsd.exceptions.CommandError

Base exception for commands returning invalid output

Parameters:
  • command (BaseCommand) – The command
  • environment (BaseSystem) – The environment on which the command is executed. Any subclass of BaseSystem
  • subcommand (str) – The subcommand, if any
  • err (str) – The error returned by the subprocess
class pybsd.exceptions.SubprocessError(command, environment, err, subcommand=None)[source]

Bases: pybsd.exceptions.CommandError

Base exception for errors returned by a subprocess

Parameters:
  • command (BaseCommand) – The command
  • environment (BaseSystem) – The environment on which the command is executed. Any subclass of BaseSystem
  • subcommand (str) – The subcommand, if any
  • err (str) – The error returned by the subprocess

Systems

class pybsd.exceptions.MasterJailError(master, jail)[source]

Bases: pybsd.exceptions.PyBSDError

Base exception for errors involving a master and a jail. It is never raised

Parameters:
  • master (Master) – The master
  • jail (Jail) – The jail
class pybsd.exceptions.AttachNonMasterError(master, jail)[source]

Bases: pybsd.exceptions.MasterJailError

Error when a master tries to import a non-jail

Parameters:
  • master (Master) – The object that was supposed to host the jail
  • jail (any) – The jail
class pybsd.exceptions.AttachNonJailError(master, jail)[source]

Bases: pybsd.exceptions.MasterJailError

Error when a master tries to import a non-jail

Parameters:
  • master (Master) – The master
  • jail (any) – The object that was supposed to be attached
class pybsd.exceptions.MasterJailMismatchError(master, jail)[source]

Bases: pybsd.exceptions.MasterJailError

Error when a master tries to import a non-jail

Parameters:
  • master (Master) – The master
  • jail (any) – The object that was supposed to be attached
class pybsd.exceptions.JailAlreadyAttachedError(master, jail)[source]

Bases: pybsd.exceptions.MasterJailError

Error when a jail is already attached to another master

Parameters:
  • master (Master) – The master
  • jail (Jail) – The jail
class pybsd.exceptions.DuplicateJailNameError(master, jail, duplicate)[source]

Bases: pybsd.exceptions.MasterJailError

Error when another jail with the same name is already attached to a master

Parameters:
  • master (Master) – The master
  • jail (Jail) – The jail
  • duplicate (str) – The duplicated hostname
class pybsd.exceptions.DuplicateJailHostnameError(master, jail, duplicate)[source]

Bases: pybsd.exceptions.DuplicateJailNameError

Error when another jail with the same hostname is already attached to a master

Parameters:
  • master (Master) – The master
  • jail (Jail) – The jail
  • duplicate (str) – The duplicated hostname
class pybsd.exceptions.DuplicateJailUidError(master, jail, duplicate)[source]

Bases: pybsd.exceptions.DuplicateJailNameError

Error when another jail with the same uid is already attached to a master

Parameters:
  • master (Master) – The master
  • jail (Jail) – The jail
  • duplicate (str) – The duplicated hostname
class pybsd.exceptions.InvalidUIDError(master, jail)[source]

Bases: pybsd.exceptions.MasterJailError

Error when a master tries to import a non-jail

Parameters:
  • master (Master) – The object that was supposed to host the jail
  • jail (any) – The jail