We can live with the incompatibility here; the hack is currently
not working anyway (see #5623).
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
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>
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. Make the CLI display only commands
marked with the 'CLI' marker.
Also stop renaming 'help' to 'helptext' in the client.
Signed-off-by: Dan Mick <dan.mick@inktank.com>