[PATCH] make samba-tool aware of all 7 fsmo roles
jelmer at jelmer.uk
Thu Jun 4 10:57:16 MDT 2015
On Thu, Jun 04, 2015 at 05:17:11PM +0100, Rowland Penny wrote:
> On 04/06/15 16:16, Jelmer Vernooij wrote:
> >On Thu, Jun 04, 2015 at 02:00:47PM +0100, Rowland Penny wrote:
> >>On 04/06/15 13:23, Jelmer Vernooij wrote:
> >>>On Thu, Jun 04, 2015 at 11:36:29AM +0100, Rowland Penny wrote:
> >>>>On 03/06/15 00:53, Jelmer Vernooij wrote:
> >>>>+ if master_owner != serviceName:
> >>>>+ if force is None:
> >>>>+ self.message("Attempting transfer...")
> >>>>+ try:
> >>>>+ transfer_dns_role(self.outf, sambaopts, credopts, role,
> >>>>+ samdb)
> >>>>+ #self.outf.write("Transfer of '%s' role was successful\n" %
> >>>>+ # role)
> >>>>+ return
> >>>>+ except:
> >>>^^ Please catch a specific exception.
> >>not sure how, any chance of a hint?
> >Do you mean what kind of exception to catch? What kind of exception would you expect to be
> >raised here? (in other words, why did you put in the "except:" ?)
> Well from what I know already (not much, I will admit) I thought that if it
> failed it would do something else, a bit like if - then - else in bash.
There is no need to explicitly catch the exception in this case - if you just let them
bubble up, samba-tool will print the exception. The downside of catching exceptions
this way is that it hides everything about the actual error.
> >>>>- assert len(res) == 1
> >>>>- self.ridMaster = res["fSMORoleOwner"]
> >>>>- self.message("InfrastructureMasterRole owner: " + self.infrastructureMaster)
> >>>>- self.message("RidAllocationMasterRole owner: " + self.ridMaster)
> >>>>- self.message("PdcEmulationMasterRole owner: " + self.pdcEmulator)
> >>>>- self.message("DomainNamingMasterRole owner: " + self.namingMaster)
> >>>>- self.message("SchemaMasterRole owner: " + self.schemaMaster)
> >>>>+ forest_dn = "DC=" + samdb.forest_dns_name().replace(".", ",DC=")
> >>>^^ Hmm, do we not have a standard function for determining a dn from a DNS name, or a way to get the forest DN?
> >>Couldn't find one.
> >Andrew, do you know of one?
> >If there isn't one, it would be good to introduce one. (That's just a side-note, I
> >don't think that should block this patch set)
> If I did create one, where should I create it, inside fsmo.py or samdb.py or
> somewhere else.
samdb.py or samba/ldb.py would probably be a good location, since this is
generic and not specific to fsmo.py.
More information about the samba-technical