rpc: replace underscores only in option names
To be backwards compatible, we allow users to pass options with both the underscores and hyphens, e.g. `bdev_get_bdevs --timeout-us 100` and `bdev_get_bdevs --timeout_us 100` are equivalent. However, python's argparse allows users to pass option values after equals sign and we would also replace any underscores in those values (e.g. `bdev_get_bdevs --name=bdev_null0` would become `bdev_get_bdevs --name=bdev-null0`). This patch fixes that. Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: I82d3adb39167ff5e20451e8ab7de7bb50edb670e Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16334 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
9a1457ff1e
commit
db8c911e5a
@ -3454,7 +3454,8 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
|
||||
for i in range(len(args)):
|
||||
arg = args[i]
|
||||
if arg.startswith('--') and "_" in arg:
|
||||
args[i] = arg.replace('_', '-')
|
||||
opt, *vals = arg.split('=')
|
||||
args[i] = '='.join([opt.replace('_', '-'), *vals])
|
||||
|
||||
plugins = []
|
||||
load_plugin(None)
|
||||
|
Loading…
Reference in New Issue
Block a user