diff options
author | Andrew Bartlett <abartlet@samba.org> | 2013-09-06 15:38:36 +1200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2013-09-16 19:36:28 +0200 |
commit | 3af4f0377e1ff8b23d415bc4b241bf8cb83c130c (patch) | |
tree | 7db59e745f86a0ee0c5fa3ca376a8aa9868d77fa | |
parent | a5e4c4520af9f7a99aac4117d1225c85b891554d (diff) | |
download | samba-3af4f0377e1ff8b23d415bc4b241bf8cb83c130c.tar.gz samba-3af4f0377e1ff8b23d415bc4b241bf8cb83c130c.tar.bz2 samba-3af4f0377e1ff8b23d415bc4b241bf8cb83c130c.zip |
join.py: Handle more error cases with useful exceptions
This will help track down strange failures in the future.
Andrew Bartlett
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r-- | python/samba/join.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/python/samba/join.py b/python/samba/join.py index ff0fe3bdfb..4f2d27343c 100644 --- a/python/samba/join.py +++ b/python/samba/join.py @@ -748,7 +748,15 @@ class dc_join(object): print("Finding domain GUID from ncName") res = ctx.local_samdb.search(base=ctx.partition_dn, scope=ldb.SCOPE_BASE, attrs=['ncName'], controls=["extended_dn:1:1", "reveal_internals:0"]) - domguid = str(misc.GUID(ldb.Dn(ctx.samdb, res[0]['ncName'][0]).get_extended_component('GUID'))) + + if 'nCName' not in res[0]: + raise DCJoinException("Can't find naming context on partition DN %s in %s" % (ctx.partition_dn, ctx.samdb.url)) + + try: + domguid = str(misc.GUID(ldb.Dn(ctx.samdb, res[0]['ncName'][0]).get_extended_component('GUID'))) + except KeyError: + raise DCJoinException("Can't find GUID in naming master on partition DN %s" % res[0]['ncName'][0]) + print("Got domain GUID %s" % domguid) print("Calling own domain provision") |