interactive

Interactive module.

spicerack.interactive.ask_confirmation(message: str) → None[source]

Ask the use for confirmation in interactive mode.

Parameters

message (str) -- the message to be printed before asking for confirmation.

Raises

SpicerackError -- on too many invalid answers or if not in a TTY.

spicerack.interactive.ensure_shell_is_durable() → None[source]

Ensure it is running either in non-interactive mode or in a screen/tmux session, raise otherwise.

Raises

spicerack.exceptions.SpicerackError -- if in a non-durable shell session.

spicerack.interactive.get_management_password() → str[source]

Get the management password either from the environment or asking for it.

Returns

the password.

Return type

str

Raises

spicerack.exceptions.SpicerackError -- if the password is empty.

spicerack.interactive.get_username() → str[source]

Detect and return the name of the effective running user even if run as root.

Returns

the name of the effective running user or - if unable to detect it.

Return type

str