Reason(reason: str, username: str, hostname: str, *, task_id: Optional[str] = None)¶
Class to manage the reason for administrative actions.
Initialize the instance.
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.
spicerack.administrative.ReasonError -- if any parameter contains double quotes.
Getter for the hostname property.
the hostname on which the code is running.
- Return type
Getter for the owner property.
Custom exception class for errors of the Reason class.