Skip to content

Commit

Permalink
ceph_argparse.py: make find_cmd_target handle tell <pgid>
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Mick <[email protected]>
  • Loading branch information
Dan Mick committed Jul 26, 2013
1 parent 8985e1c commit d75b6ea
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/pybind/ceph_argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,20 +897,35 @@ def find_cmd_target(childargs):
sig = parse_funcsig(['tell', {'name':'target','type':'CephName'}])
try:
valid_dict = validate(childargs, sig, partial=True);
except ArgumentError:
pass
else:
if len(valid_dict) == 2:
# revalidate to isolate type and id
name = CephName()
# if this fails, something is horribly wrong, as it just
# validated successfully above
name.valid(valid_dict['target'])
return name.nametype, name.nameid

sig = parse_funcsig(['tell', {'name':'pgid','type':'CephPgid'}])
try:
valid_dict = validate(childargs, sig, partial=True);
except ArgumentError:
pass
else:
if len(valid_dict) == 2:
# pg doesn't need revalidation; the string is fine
return 'pg', valid_dict['pgid']

sig = parse_funcsig(['pg', {'name':'pgid','type':'CephPgid'}])
try:
valid_dict = validate(childargs, sig, partial=True);
if len(valid_dict) == 2:
return 'pg', valid_dict['pgid']
except ArgumentError:
pass
else:
if len(valid_dict) == 2:
return 'pg', valid_dict['pgid']

return 'mon', ''

Expand Down

0 comments on commit d75b6ea

Please sign in to comment.