Refactor command handling
This now supports usage/help texts
This commit is contained in:
@ -12,9 +12,15 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
@final
|
||||
class GetSecret(CommandDispatcher):
|
||||
"""Get Secret."""
|
||||
"""Retrieve an encrypted secret.
|
||||
|
||||
Returns the value of the secret provided as a mandatory argument.
|
||||
The secret will be encrypted using the stored RSA public key, and returned
|
||||
as a base64 encoded string.
|
||||
"""
|
||||
|
||||
name = "get_secret"
|
||||
mandatory_argument = "SECRET"
|
||||
|
||||
@override
|
||||
async def exec(self) -> None:
|
||||
@ -22,6 +28,7 @@ class GetSecret(CommandDispatcher):
|
||||
if len(self.arguments) != 1:
|
||||
raise exceptions.UnknownClientOrSecretError()
|
||||
secret_name = self.arguments[0]
|
||||
LOG.debug("get_secret called: Argument: %r", secret_name)
|
||||
if secret_name not in self.client.secrets:
|
||||
await self.audit(
|
||||
Operation.DENY,
|
||||
|
||||
Reference in New Issue
Block a user