]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
ceph CLI: valid() no longer returns bool, but just exception
authorDan Mick <dan.mick@inktank.com>
Wed, 10 Jul 2013 23:24:45 +0000 (16:24 -0700)
committerDan Mick <dan.mick@inktank.com>
Thu, 11 Jul 2013 02:02:30 +0000 (19:02 -0700)
commita5621625e1b38fe4d1644cb2f5639f8fdabaad64
treeb42eb4b9ae825646028816c1036cf447c016958a
parent0f2ebc6ee3825a13ea4c328354da96b6cfc93d63
ceph CLI: valid() no longer returns bool, but just exception

The type validation's valid() method was using a combination of
return code and exception to really indicate the same thing;
simplify by only raising on validation error, and change callers
to cope.  validate_one() follows suit.

Also, allow validate() to be called with args that are dicts
(for REST support) rather than bare words.  Rules: 'name':'value'
must both match descriptor's name and validate (through valid() for
the value.  If value is '', it's assumed to be the same as name,
(one can pass, for example, "detail" as one parameter to
REST, but it will still show up as {'detail':''} here).

Tweak validate()'s algorithm a bit in the process, and make
validate_command() exit the bestcmds loop immediately on first
full validation.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
src/ceph.in
src/pybind/ceph_argparse.py