From 36f98b43bd571ac9f2f4f9a9fe658684d591d52e Mon Sep 17 00:00:00 2001 From: rabbitali Date: Fri, 27 Oct 2023 15:21:54 +0800 Subject: [PATCH] bugfix: update host api request error when changing username --- zeus/host_manager/view.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/zeus/host_manager/view.py b/zeus/host_manager/view.py index 95e1434..10418d1 100644 --- a/zeus/host_manager/view.py +++ b/zeus/host_manager/view.py @@ -930,11 +930,11 @@ class UpdateHost(BaseResponse): LOGGER.warning(f"there is a duplicate host address in database " f"when update host {self.host.host_id}!") return self.response(code=state.PARAM_ERROR, message="there is a duplicate host ssh address in database!") - if params.get("ssh_user") or params.get("ssh_port"): - if not params.get("password") or not params.get("ssh_pkey"): - return self.response(code=state.PARAM_ERROR, message="please update password or authentication key.") - self._save_ssh_key(params) - elif params.get("password") or params.get("ssh_pkey"): + if params.get("password") or params.get("ssh_pkey"): self._save_ssh_key(params) + return self.response(callback.update_host_info(params.pop("host_id"), params)) + + if params.get("ssh_user") or params.get("ssh_port"): + return self.response(code=state.PARAM_ERROR, message="please update password or authentication key.") return self.response(callback.update_host_info(params.pop("host_id"), params)) -- 2.33.0