summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorGarming Sam <garming@catalyst.net.nz>2014-02-05 15:29:18 +1300
committerAndrew Bartlett <abartlet@samba.org>2014-02-05 08:42:25 +0100
commitb27543aa729ca893270831d5c4fc74ea7ac6d407 (patch)
tree44aff90deabd38683c9234ce8a6c8dd4579d46da /python
parente76bbef8b796441985550c553db1ab48d6495709 (diff)
downloadsamba-b27543aa729ca893270831d5c4fc74ea7ac6d407.tar.gz
samba-b27543aa729ca893270831d5c4fc74ea7ac6d407.tar.xz
samba-b27543aa729ca893270831d5c4fc74ea7ac6d407.zip
provision: improve error message when connecting to samdb without the correct permissions
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/provision/__init__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py
index c0735d3a58b..fc9e0bed75c 100644
--- a/python/samba/provision/__init__.py
+++ b/python/samba/provision/__init__.py
@@ -1203,7 +1203,13 @@ def setup_samdb(path, session_info, provision_backend, lp, names,
# And now we can connect to the DB - the schema won't be loaded from the
# DB
- samdb.connect(path)
+ try:
+ samdb.connect(path)
+ except ldb.LdbError, (num, string_error):
+ if (num == ldb.ERR_INSUFFICIENT_ACCESS_RIGHTS):
+ raise ProvisioningError("Permission denied connecting to %s, are you running as root?" % path)
+ else:
+ raise
# But we have to give it one more kick to have it use the schema
# during provision - it needs, now that it is connected, to write