Commit bd0807fe authored by Guido Trotter's avatar Guido Trotter
Browse files

RAPI: remove required parameters for reinstall

Before c744425f

 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: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 043beb38
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment