mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-22 15:13:50 -06:00
batch: account for auto-binding in server context
When batch runs under server context, we have no context.principal set because we talk directly to LDAPI endpoint and authenticate using auto-binding, not GSSAPI. Account to that in the logger. Fixes: https://pagure.io/freeipa/issue/9583 Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com> Reviewed-By: Thomas Woerner <twoerner@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com> Reviewed-By: Rafael Guterres Jeffman <rjeffman@redhat.com>
This commit is contained in:
parent
295ac6385c
commit
3608b2b63d
@ -159,6 +159,7 @@ class batch(Command):
|
||||
|
||||
def execute(self, methods=None, **options):
|
||||
results = []
|
||||
op_account = getattr(context, 'principal', '[autobind]')
|
||||
for arg in (methods or []):
|
||||
params = dict()
|
||||
name = None
|
||||
@ -174,7 +175,7 @@ class batch(Command):
|
||||
result = api.Command[name](*a, **newkw)
|
||||
logger.info(
|
||||
'%s: batch: %s(%s): SUCCESS',
|
||||
getattr(context, 'principal', 'UNKNOWN'),
|
||||
op_account,
|
||||
name,
|
||||
', '.join(api.Command[name]._repr_iter(**params))
|
||||
)
|
||||
@ -185,13 +186,13 @@ class batch(Command):
|
||||
isinstance(e, errors.ConversionError)):
|
||||
logger.info(
|
||||
'%s: batch: %s',
|
||||
context.principal,
|
||||
op_account,
|
||||
e.__class__.__name__
|
||||
)
|
||||
else:
|
||||
logger.info(
|
||||
'%s: batch: %s(%s): %s',
|
||||
context.principal, name,
|
||||
op_account, name,
|
||||
', '.join(api.Command[name]._repr_iter(**params)),
|
||||
e.__class__.__name__
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user