From: Redouane Kachach Date: Tue, 7 Jul 2026 13:47:11 +0000 (+0200) Subject: qa/cephadm: fix hardcoded 'sshd' unit name in setup_ca_signed_keys X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7b2217caf3c720ca058e3525276d8b6e205fcacb;p=ceph.git qa/cephadm: fix hardcoded 'sshd' unit name in setup_ca_signed_keys setup_ca_signed_keys() hardcoded `systemctl restart sshd`, which fails on Debian/Ubuntu where the SSH server unit is named `ssh.service` rather than `sshd.service`. Try `ssh` first, fall back to `sshd` if that fails, grouped so the fallback only fires on restart failure and doesn't mask a failed config write. Fixes: https://tracker.ceph.com/issues/77991 Signed-off-by: Redouane Kachach --- diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index 6b08d8885e3..2c426044abb 100644 --- a/qa/tasks/cephadm.py +++ b/qa/tasks/cephadm.py @@ -628,12 +628,14 @@ def setup_ca_signed_keys(ctx, config): 'sudo', 'tee', '-a', '/etc/ssh/ca-key.pub', ]) # make sshd accept the CA signed key + # NOTE: the SSH server systemd unit is named 'ssh' on Debian/Ubuntu + # and 'sshd' on RHEL/CentOS/Rocky -- try both, but only after the + # config write itself has succeeded (grouped with parens so the + # restart fallback doesn't mask a failed config write). remote.run(args=[ - 'sudo', 'echo', 'TrustedUserCAKeys /etc/ssh/ca-key.pub', - run.Raw('|'), - 'sudo', 'tee', '-a', '/etc/ssh/sshd_config', - run.Raw('&&'), - 'sudo', 'systemctl', 'restart', 'sshd', + 'sudo', 'sh', '-c', + "echo 'TrustedUserCAKeys /etc/ssh/ca-key.pub' | sudo tee -a /etc/ssh/sshd_config && " + "(sudo systemctl restart ssh || sudo systemctl restart sshd)" ]) # generate a new key pair and sign the pub key to make a cert