cli/request: allow enforcing a given serialisation
Description of the problem
When passing a parameters file (option --parameters-file
) to slapos request
, parameters can be sent in two ways: as XML, or using JSON-in-XML. In order to decide which of the two types of serialisation should be used, we currently fetch the schema and use the serialisation
parameter embedded in it. If no schema is found, for any reason whatsoever (no schema in the repository, flawed Internet access, etc), then the request will fail.
For most cases, since the schema is only required on request, this is not a huge issue: the schema can be added or it is possible to retry. However, when the network is not accessible at all, is not possible: deploying SRs will fail in any case. I encountered this case when deploying SRs without Internet access, using only a local cache: everything works except this one thing.
Proposed solution
This MR fixes the problem by adding a --force-serialisation
to slapos request
. The default behaviour is kept when the parameter is not set, but when set, this parameter will override anything else. This means that setting --force-serialisation xml
will always send parameters in XML, even if a schema defines another serialisation format.