[PATCH] [WIP] Catch ProvisioningError in samba-tool domain classicupgrade (was Re: [PATCHES] samba-tool: Don't print python stack traces in log level 0)

Jelmer Vernooij jelmer at samba.org
Sat Nov 10 20:18:37 MST 2012


On Sun, 2012-11-11 at 12:36 +1100, Andrew Bartlett wrote:
> On Fri, 2012-11-09 at 14:05 +0100, Jelmer Vernooij wrote:
> > Hi Metze,
> > 
> > On Fri, 2012-11-09 at 09:20 +0100, Stefan (metze) Metzmacher wrote:
> > > Hi Karolin,
> > > 
> > > here're the patches we've discussed and tested yesterday...
> > -1, The behaviour here is intentional - the backtrace is only printed on
> > unexpected exceptions, and printed so that it is easier for users to
> > communicate with us about them. 
> > 
> > If there is an expected exception, please catch it and raise
> > CommandError("Some one line message that makes sense to the user.",
> > original_exception).
> 
> Jelmer,
> 
> I was trying to do this for samba-tool domain classicupgrade, as users
> are having trouble seeing the actual error in the backtrace.  However,
> as the second patch I attach here shows, it doesn't seem to work.  Any
> idea what is wrong with the way ProvisioningError is being caught in
> domain.py?
> 
> (to trigger, run this:)
> make test TESTS=samba4.blackbox.upgrade

This is happening because at the moment, the logic in netcmd that
decides whether to print a traceback prints a traceback when
CommandError is raised if there is an internal exception set. An
alternative approach could be:

raise CommandError("Provisioning failed: %s" % original_exception)

Cheers,

Jelmer



More information about the samba-technical mailing list