]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
samba-tool: do not crash on unimplemented .run()
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Tue, 16 Aug 2022 01:43:54 +0000 (13:43 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 8 Sep 2022 22:34:36 +0000 (22:34 +0000)
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 <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/__init__.py

index 73292489268c220344257f037906f7bedfc77778..21738cf51fb408a9b0dabbb51303f3b305ea6fca 100644 (file)
@@ -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."""