If, for whatever reason, a FSMO role has no fSMORoleOwner attribute, Samba-tool shows an 'uncaught exception' i.e. samba-tool fsmo seize --role=all ERROR(<type 'exceptions.KeyError'>): uncaught exception - 'No such element' File "/usr/lib/python2.7/dist-packages/samba/netcmd/__init__.py", line 175, in _run return self.run(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/samba/netcmd/fsmo.py", line 345, in run versionopts, force) File "/usr/lib/python2.7/dist-packages/samba/netcmd/fsmo.py", line 301, in seize_dns_role master_owner = get_fsmo_roleowner(samdb, m.dn) File "/usr/lib/python2.7/dist-packages/samba/netcmd/fsmo.py", line 42, in get_fsmo_roleowner master_owner = res[0]["fSMORoleOwner"][0] This is caused by this code in fsmo.py: def get_fsmo_roleowner(samdb, roledn): """Gets the owner of an FSMO role :param roledn: The DN of the FSMO role """ res = samdb.search(roledn, scope=ldb.SCOPE_BASE, attrs=["fSMORoleOwner"]) assert len(res) == 1 master_owner = res[0]["fSMORoleOwner"][0] return master_owner As 'fSMORoleOwner' is a single-valued attribute, it can only exist or not, there cannot be more than one instance, so the last part of the above code should be: if len(res) == 0: raise Exception('"%s" does not have a FSMO roleowner' % roledn) master_owner = res[0]["fSMORoleOwner"][0] return master_owner This will print a message and exit if there is no 'fSMORoleOwner' attribute found. Patch to follow.
Created attachment 11611 [details] make samba-tool fsmo print error message if no fSMORoleOwner attribute found
Created attachment 11675 [details] git-am fix for 4.3.next
Comment on attachment 11675 [details] git-am fix for 4.3.next LGTM.
Re-assigning to Karolin for inclusion in 4.3.next.
Pushed to autobuild-v4-3-test.
(In reply to Karolin Seeger from comment #5) Pushed to v4-3-test. Closing out bug report. Thanks!
There're more fixes required...
Created attachment 12155 [details] Additional patch for v4-4-test
Created attachment 12156 [details] Additional patch for v4-3-test
Pushed additional patches to autobuild-v4-[4|3]-test.
(In reply to Karolin Seeger from comment #10) Gnaaa, no review yet, removing and waiting for review first.
(In reply to Karolin Seeger from comment #11) Pushed additional patches to autobuild-v4-[4|3]-test.
(In reply to Karolin Seeger from comment #12) Pushed to both branches. Closing out bug report. Thanks!