summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorPetr Spacek <pspacek@redhat.com>2016-04-22 10:54:44 +0200
committerJan Cholasta <jcholast@redhat.com>2016-05-12 13:28:00 +0200
commit89cdf6ee1e796e5ba4c302a19da4862e18b99c4a (patch)
tree039bebedf98cc2429bfc8231a7b53ea8699b7d10 /ipalib
parent93332bcf4dd0189b7136db7fe4f900fc04171d20 (diff)
downloadfreeipa-89cdf6ee1e796e5ba4c302a19da4862e18b99c4a.tar.gz
freeipa-89cdf6ee1e796e5ba4c302a19da4862e18b99c4a.tar.xz
freeipa-89cdf6ee1e796e5ba4c302a19da4862e18b99c4a.zip
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>
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/plugins/batch.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/ipalib/plugins/batch.py b/ipalib/plugins/batch.py
index 2da7b7ca8..42edba2ad 100644
--- a/ipalib/plugins/batch.py
+++ b/ipalib/plugins/batch.py
@@ -107,7 +107,10 @@ class batch(Command):
result = api.Command[name](*a, **newkw)
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
except Exception as e: