[Samba] samba-tool computer delete does not work
Douglas Bagnall
douglas.bagnall at catalyst.net.nz
Wed Nov 20 20:40:29 UTC 2024
On 21/11/24 04:17, Rowland Penny via samba wrote:
> After reading the code again and thinking about this (yes I know,
> thinking is dangerous), I think this is what is happening:
>
> The samba tool command is run and everything works okay until it gets
> to the 'try', the first thing that the 'try' does is to delete the
> computers entire DN, it then attempts to delete all the computers dns
> records, if this or deleting the computers DN fails, then, from my
> understanding, the 'try' should fail and the computers DN deletion
> should not happen and an error message 'Failed to remove computer "%s"'
> should be printed.
Try blocks don't work like that in python -- they are not transactions,
just a kind of goto-on-error. So the deletion of the original object is
never going to be rolled back, control-C or not.
We *could* make it a transaction, by sprinkling
`samdb.transaction_start()`, `samdb.transaction_commit()`,
`samdb.transaction_cancel()` around in the right places (which could let
control-C cancel the whole thing, but ).
In any case, DNS still looks like the problem.
Douglas
More information about the samba
mailing list