From 8b403ab7c55aa3f269b38b19553f50303012025c Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Tue, 16 Aug 2022 13:43:54 +1200 Subject: [PATCH] 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 --- python/samba/netcmd/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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."""