mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Batch command: avoid accessing potentially undefined context.principal
This might happen when the command is called directly in Python, e.g. in installers and so on. Pylint pylint-1.5.5-1.fc24.noarch caught this. https://fedorahosted.org/freeipa/ticket/5838 Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
committed by
Jan Cholasta
parent
93332bcf4d
commit
89cdf6ee1e
@@ -107,7 +107,10 @@ class batch(Command):
|
|||||||
|
|
||||||
result = api.Command[name](*a, **newkw)
|
result = api.Command[name](*a, **newkw)
|
||||||
self.info(
|
self.info(
|
||||||
'%s: batch: %s(%s): SUCCESS', context.principal, name, ', '.join(api.Command[name]._repr_iter(**params))
|
'%s: batch: %s(%s): SUCCESS',
|
||||||
|
getattr(context, 'principal', 'UNKNOWN'),
|
||||||
|
name,
|
||||||
|
', '.join(api.Command[name]._repr_iter(**params))
|
||||||
)
|
)
|
||||||
result['error']=None
|
result['error']=None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user