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 ofBaseSystem
- interface (
Interface
) – The interface
- environment (
-
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 ofBaseSystem
- interface (
Interface
) – The interface
- environment (
-
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 ofBaseSystem
- interface (
Interface
) – The interface - reason (
str
) – The reason why this main if is invalid
- environment (
-
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 ofBaseSystem
- interface (
Interface
) – The interface - ips (
set
) – The ips
- environment (
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 ofBaseSystem
- command (
-
class
pybsd.exceptions.
InvalidCommandNameError
(command, environment)[source]¶ Bases:
pybsd.exceptions.BaseCommandError
Error when a command is missing a name attribute
Parameters: - command (
BaseCommand
) – The command - environment (
BaseSystem
) – The environment on which the command is deployed. Any subclass ofBaseSystem
- command (
-
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: - command (
BaseCommand
) – The command - environment (
BaseSystem
) – The environment on which the command is deployed. Any subclass ofBaseSystem
- command (
-
class
pybsd.exceptions.
CommandConnectionError
(command, environment)[source]¶ Bases:
pybsd.exceptions.BaseCommandError
Error when a command is missing a name attribute
Parameters: - command (
BaseCommand
) – The command - environment (
BaseSystem
) – The environment on which the command is deployed. Any subclass ofBaseSystem
- command (
-
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 ofBaseSystem
- subcommand (
str
) – The subcommand, if any
- command (
-
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 ofBaseSystem
- subcommand (
str
) – The subcommand, if any
- command (
-
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 ofBaseSystem
- subcommand (
str
) – The subcommand, if any - err (
str
) – The error returned by the subprocess
- command (
-
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 ofBaseSystem
- subcommand (
str
) – The subcommand, if any - err (
str
) – The error returned by the subprocess
- command (
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:
-
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
- master (
-
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
- master (
-
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
- master (
-
class
pybsd.exceptions.
JailAlreadyAttachedError
(master, jail)[source]¶ Bases:
pybsd.exceptions.MasterJailError
Error when a jail is already attached to another master
Parameters:
-
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:
-
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:
-
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:
-
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
- master (