[PATCH] make samba-tool aware of all 7 fsmo roles

Jelmer Vernooij jelmer at jelmer.uk
Thu Jun 4 10:59:53 MDT 2015


On Thu, Jun 04, 2015 at 05:49:14PM +0100, Rowland Penny wrote:
> On 04/06/15 17:17, 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:
> OK, so I had a look at this:
> 
> >>> +        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:
> 
> I now think we were discussing the wrong thing :-D
> 
> I have re-written it to this:
> 
>         if master_owner != serviceName:
>             if force is None:
>                 self.message("Attempting transfer...")
>                     try:
>                         #Any Error msg will be printed by 'transfer_role'
>                         transfer_role(self.outf, sambaopts, credopts, role,
>                                           samdb)
>                         return
Why does this have a try and a return at all? That doesn't seem necessary. You
can just raise CommandError from transfer_role(); no need for extra code on
the caller side.

> So when it goes to 'transfer_role' it ends up running this:
> 
>     if master_owner != new_owner:
>         try:
>             samdb.modify(m)
>         except LdbError, (num, msg):
>             raise CommandError("Transfer of '%s' role failed: %s" %
>                                (role, msg))
+1. This bit looks good.

Cheers,

Jelmer


More information about the samba-technical mailing list