join.py: Correctly print an error in DsAddEntry when .info is None
authorAndrew Bartlett <abartlet@samba.org>
Sat, 11 Feb 2017 06:34:09 +0000 (19:34 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 14 Feb 2017 08:46:23 +0000 (09:46 +0100)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
python/samba/join.py

index 60773c49a6ce1472514a869cd202ed9c1eb43560..058fa083bb4d3369e53d246dd77c8815381d51e6 100644 (file)
@@ -492,8 +492,11 @@ class dc_join(object):
             if ctr.err_ver != 1:
                 raise RuntimeError("expected err_ver 1, got %u" % ctr.err_ver)
             if ctr.err_data.status[0] != werror.WERR_SUCCESS:
-                print("DsAddEntry failed with status %s info %s" % (ctr.err_data.status,
-                                                                    ctr.err_data.info.extended_err))
+                if ctr.err_data.info is None:
+                    print("DsAddEntry failed with status %s, info omitted" % (ctr.err_data.status[1]))
+                else:
+                    print("DsAddEntry failed with status %s info %s" % (ctr.err_data.status[1],
+                                                                        ctr.err_data.info.extended_err))
                 raise RuntimeError("DsAddEntry failed")
             if ctr.err_data.dir_err != drsuapi.DRSUAPI_DIRERR_OK:
                 print("DsAddEntry failed with dir_err %u" % ctr.err_data.dir_err)