cert-request: better error msg when 'add' not supported

cert-request supports adding service principals that don't exist.
If add is requested for other principal types, the error message
just says "the principal doesn't exist".

Add a new error type with better error message to explain that 'add'
is not supported for host or user principals.

Fixes: https://fedorahosted.org/freeipa/ticket/5991
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
Fraser Tweedale
2016-06-29 15:02:51 +10:00
committed by Martin Basti
parent 025cfd911b
commit 3fab1b6350
2 changed files with 28 additions and 3 deletions

View File

@@ -1397,6 +1397,16 @@ class ServerRemovalError(ExecutionError):
format = _('Server removal aborted: %(reason)s.')
class OperationNotSupportedForPrincipalType(ExecutionError):
"""
**4034** Raised when an operation is not supported for a principal type
"""
errno = 4034
format = _(
'%(operation)s is not supported for %(principal_type)s principals')
class BuiltinError(ExecutionError):
"""
**4100** Base class for builtin execution errors (*4100 - 4199*).