administrative

Administrative module.

class spicerack.administrative.Reason(reason, username, hostname, *, task_id=None)[source]

Bases: object

Class to manage the reason for administrative actions.

Initialize the instance.

Parameters:
  • reason (str) -- the reason to use to justify an administrative action. The username and the hostname where the action was originated will be added to the reason automatically. The reason is meant to be passed to remote execution in double quotes, allowing to use Bash variables, if needed. Therefore the reason cannot contain double quotes.
  • username (str) -- the username to mention in the reason as the author of the action.
  • hostname (str) -- the hostname to mention in the reason as the host originating the action.
  • task_id (str, optional) -- the task ID to mention in the reason.
Raises:

spicerack.administrative.ReasonError -- if any parameter contains double quotes.

owner

Getter for the owner property.

Returns:the origin (user@host) of the currently running code.
Return type:str
quoted()[source]

Quoted string representation of the instance, including all attributes.

Returns:the generated string representation of all the instance attributes, double quoted.
Return type:str
exception spicerack.administrative.ReasonError[source]

Bases: spicerack.exceptions.SpicerackError

Custom exception class for errors of the Reason class.