rados.py: allow long-form names of 'warn' and 'err' as watch levels

Signed-off-by: Dan Mick <dan.mick@inktank.com>
AuthMonitor, KeyRing: add Formatter-dumps of auth info

Signed-off-by: Dan Mick <dan.mick@inktank.com>
AuthMonitor: early out on bad entity name

Signed-off-by: Dan Mick <dan.mick@inktank.com>
ceph_argparse.py: clean up some questionable code

Signed-off-by: Dan Mick <dan.mick@inktank.com>
ceph_argparse.py: validate(): better comment, check for unparsed args

Signed-off-by: Dan Mick <dan.mick@inktank.com>
ceph.in: Move descsort to ceph_argparse.py

Signed-off-by: Dan Mick <dan.mick@inktank.com>
ceph_argparse.py: CephObjectname didn't need a non-default valid()

Signed-off-by: Dan Mick <dan.mick@inktank.com>
ceph_argparse.py: change valid() conventions, accept tuple/list args

valid() used to either return False or raise an exception on various
sorts of invalid behavior; this was confusing and unnecessary.  Make
it simply raise exceptions, and adjust callers to cope.

Also, allow validate_one() to accept either a simple string argument
or a tuple/list argument representing "name=val" (for REST API support).
Invalid conditions now include name mismatch with name of arg in
descriptor.  If no value is given, assume value is the same as name.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
Add first cut of REST API daemon/config file.

To run: python ./api; starts HTTP server on port 0.0.0.0:5000

Signed-off-by: Dan Mick <dan.mick@inktank.com>
MonCommands: add new fields: modulename, perms, availability

To help optimize the REST API, we need to know whether the commands
are read (GET) or write (PUT/POST).  However, we also could use that
same info for permission/caps checking.  Add modulename/perms as
the required caps for each command to drive both needs.

The availability field is to control whether a command is displayed/
advertised through the CLI or REST interfaces; some commands aren't
really useful for REST, and we may want to invent REST-only commands;
also, this gives us a way to deprecate commands quickly and leave the
code, should that be desirable.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
MonCap: add parse_permstr() to interpret MonCommands req_perm fields

Signed-off-by: Dan Mick <dan.mick@inktank.com>
ceph.in: find_cmd_target() must now ignore ArgumentErrors from validate()

Signed-off-by: Dan Mick <dan.mick@inktank.com>
ceph, api, ceph_argparse: accept new cmddesc fields

Accept 'module', 'perm', and 'avail'; send module & perm along with cmd
Let 'help' stay 'help' (no reason to rename it 'helptext' here)

Signed-off-by: Dan Mick <dan.mick@inktank.com>
Monitor, cmdparse: dump new fields (don't forget daemon commands too)

Signed-off-by: Dan Mick <dan.mick@inktank.com>
api: cleanup
ceph, api, ceph_argparse: process new fields in cmddescs

Filter commands not tagged with 'cli' or 'rest' as appropriate
Process and pass back 'module' and 'perm'

Signed-off-by: Dan Mick <dan.mick@inktank.com>
MonCommands: remove "osd cluster_snap" from both cli and REST frontends

Signed-off-by: Dan Mick <dan.mick@inktank.com>
PGMonitor: first example of using 'module' and 'perm'

I want to get buyoff on this before continuing
KeyRing: make formatted dump use object rather than array

Signed-off-by: Dan Mick <dmick@danceorelse.org>
Rename 'api' to 'ceph-rest-api'

Signed-off-by: Dan Mick <dan.mick@inktank.com>