mirror of
https://github.com/ceph/ceph
synced 2024-12-26 21:43:10 +00:00
Merge pull request #666 from dmick/wip-6384
ceph.in: clean up error message when missing required parameter
This commit is contained in:
commit
26235e4984
@ -843,6 +843,11 @@ def validate(args, signature, partial=False):
|
||||
# wanted n, got too few
|
||||
if partial:
|
||||
return d
|
||||
# special-case the "0 expected 1" case
|
||||
if desc.numseen == 0 and desc.n == 1:
|
||||
raise ArgumentNumber(
|
||||
'missing required parameter {0}'.format(desc)
|
||||
)
|
||||
raise ArgumentNumber(
|
||||
'saw {0} of {1}, expected {2}'.\
|
||||
format(desc.numseen, desc, desc.n)
|
||||
@ -951,6 +956,7 @@ def validate_command(sigdict, args, verbose=False):
|
||||
# Stop now, because we have the right command but
|
||||
# some other input is invalid
|
||||
print >> sys.stderr, "Invalid command: ", str(e)
|
||||
print >> sys.stderr, concise_sig(sig), ': ', cmd['help']
|
||||
return {}
|
||||
if found:
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user