Before c744425f354f1bef2d0d7d306e2d00c494d67d2b instance reinstall accepted the "os" and "nostartup" optional query parameters. With that commit it was changed to allow "os" "start" and "osparams" via body rather than encoded in the URL. Unfortunately that commit introduced a bug, which required the "os" parameter to be passed for body requests, and at least one of "os" or "nostartup" for query request.
This fix makes sure all parameters are optional again. Signed-off-by: Guido Trotter <[email protected]> --- lib/rapi/rlib2.py | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py index a3bf4cd..da22b99 100644 --- a/lib/rapi/rlib2.py +++ b/lib/rapi/rlib2.py @@ -1026,7 +1026,7 @@ def _ParseInstanceReinstallRequest(name, data): if not isinstance(data, dict): raise http.HttpBadRequest("Invalid body contents, not a dictionary") - ostype = baserlib.CheckParameter(data, "os") + ostype = baserlib.CheckParameter(data, "os", default=None) start = baserlib.CheckParameter(data, "start", exptype=bool, default=True) osparams = baserlib.CheckParameter(data, "osparams", default=None) @@ -1062,14 +1062,14 @@ class R_2_instances_name_reinstall(baserlib.R_Generic): raise http.HttpBadRequest("Can't combine query and body parameters") body = self.request_body - else: - if not self.queryargs: - raise http.HttpBadRequest("Missing query parameters") + elif self.queryargs: # Legacy interface, do not modify/extend body = { "os": self._checkStringVariable("os"), "start": not self._checkIntVariable("nostartup"), } + else: + body = {} ops = _ParseInstanceReinstallRequest(self.items[0], body) -- 1.7.2.3
