samba-tool: Make the 'bytes' option type avaiable
authorGary Lockyer <gary@catalyst.net.nz>
Fri, 21 Jun 2019 01:12:01 +0000 (13:12 +1200)
committerGary Lockyer <gary@samba.org>
Tue, 2 Jul 2019 02:23:08 +0000 (02:23 +0000)
Allow samba tool to use the custom bytes option type.
  Option("--size", type="bytes", metavar="SIZE")
To allow the input of file and memory sizes using unit suffixes i.e.  2Gb,
4KiB ...

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/__init__.py

index 54e9107005a10ab985e7a974965a4068ce5421b0..57df46343e953aea114f1ecdbbeed2fdb3395365 100644 (file)
@@ -19,6 +19,7 @@
 import optparse
 import samba
 from samba import colour
+from samba.getopt import SambaOption
 from samba.logger import get_samba_logger
 from ldb import LdbError
 import sys
@@ -26,7 +27,7 @@ import traceback
 import textwrap
 
 
-class Option(optparse.Option):
+class Option(SambaOption):
     SUPPRESS_HELP = optparse.SUPPRESS_HELP
     pass