]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
ceph_argparse: increment matchcnt on kwargs 33160/head
authorMatthew Oliver <moliver@suse.com>
Tue, 4 Feb 2020 02:29:48 +0000 (13:29 +1100)
committerShyukri Shyukriev <shshyukriev@suse.com>
Sun, 22 Mar 2020 08:53:06 +0000 (10:53 +0200)
commit824590fcabc908194c55abde40dbf9d63efe0010
tree2a829442823448ba509aaa4e7a4ebc05957a70b5
parent860b1289354997618980be07d0fa7ada575a1f90
ceph_argparse: increment matchcnt on kwargs

Currently when you pass a param in on the ceph cli as a kwarg
(--<param_name>) the matchcnt isn't incremented in the validate method
which is used to choose the right command signature.

This means currently things fail like:

  ceph orchestrator rgw rm --realm_name=default --zone_name=default
  no valid command found; 1 closest matches:
  orchestrator rgw rm <realm_name> <zone_name>
  Error EINVAL: invalid command

The '--realm_name' and '--zone_name' isn't counted to the matchcnt, so
'orchestrator rgw rm' isn't picked as the valid command.

This patch simply corrects this by incrementing matchcnt on the kwarg
validate path before calling shortcircuiting the loop.

Fixes: https://tracker.ceph.com/issues/43803
Signed-off-by: Matthew Oliver <moliver@suse.com>
(cherry picked from commit cb37c9ee609864a078edf38d98608bd8cc18cbd7)

Conflicts:

  test: exclude helper method from nosetest discovery

  On nautilus the assertion helper was recognized by nosetest as a test
  even though it doens't start with test_ prefix. Explicitely decorate it
  with @nottest

Signed-off-by: Shyukri Shyukriev <shshyukriev@suse.com>
src/pybind/ceph_argparse.py
src/test/pybind/test_ceph_argparse.py