to applease mypy, otherwise, for instance, "err" would be reused for
holding the return value of self.mgr.check_mon_command(...)
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit
53415832cdbef94d2f3777e8f3abb8560b15323e)
raise OrchestratorError(msg, errno=rc)
# call the host-maintenance function
- out, _err, _code = CephadmServe(self)._run_cephadm(hostname, cephadmNoImage, "host-maintenance",
- ["enter"],
- error_ok=True)
- if out:
+ _out, _err, _code = CephadmServe(self)._run_cephadm(hostname, cephadmNoImage, "host-maintenance",
+ ["enter"],
+ error_ok=True)
+ if _out:
raise OrchestratorError(
f"Failed to place {hostname} into maintenance for cluster {self._cluster_fsid}")
if tgt_host['status'] != "maintenance":
raise OrchestratorError(f"Host {hostname} is not in maintenance mode")
- out, _err, _code = CephadmServe(self)._run_cephadm(hostname, cephadmNoImage, 'host-maintenance',
- ['exit'],
- error_ok=True)
- if out:
+ outs, errs, _code = CephadmServe(self)._run_cephadm(hostname, cephadmNoImage, 'host-maintenance',
+ ['exit'],
+ error_ok=True)
+ if outs:
raise OrchestratorError(
f"Failed to exit maintenance state for host {hostname}, cluster {self._cluster_fsid}")
'format': 'json'
})
try:
- ret = json.loads(out)
+ return json.loads(out)
except ValueError:
logger.exception(f'Cannot decode JSON: \'{out}\'')
return {}
- return ret
def get_pg_count(self, osd_id: int, osd_df: Optional[dict] = None) -> int:
if not osd_df:
continue
# make sure host has latest container image
- out, err, code = CephadmServe(self.mgr)._run_cephadm(
+ out, errs, code = CephadmServe(self.mgr)._run_cephadm(
d.hostname, '', 'inspect-image', [],
image=target_image, no_fsid=True, error_ok=True)
if code or json.loads(''.join(out)).get('image_id') != target_id:
logger.info('Upgrade: Pulling %s on %s' % (target_image,
d.hostname))
- out, err, code = CephadmServe(self.mgr)._run_cephadm(
+ out, errs, code = CephadmServe(self.mgr)._run_cephadm(
d.hostname, '', 'pull', [],
image=target_image, no_fsid=True, error_ok=True)
if code: