From: Douglas Bagnall Date: Tue, 16 Aug 2022 01:43:54 +0000 (+1200) Subject: samba-tool: do not crash on unimplemented .run() X-Git-Tag: talloc-2.4.0~1129 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8b403ab7c55aa3f269b38b19553f50303012025c;p=thirdparty%2Fsamba.git samba-tool: do not crash on unimplemented .run() The run() method is always called with arguments, so it crashes before the NotImplementedError() is ever reached. That's OK, but this is better. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/netcmd/__init__.py b/python/samba/netcmd/__init__.py index 73292489268..21738cf51fb 100644 --- a/python/samba/netcmd/__init__.py +++ b/python/samba/netcmd/__init__.py @@ -198,9 +198,9 @@ class Command(object): self.show_command_error(e) return -1 - def run(self): + def run(self, *args, **kwargs): """Run the command. This should be overridden by all subclasses.""" - raise NotImplementedError(self.run) + raise NotImplementedError(f"'{self.command_name}' run method not implemented") def get_logger(self, name="", verbose=False, quiet=False, **kwargs): """Get a logger object."""