Project

General

Profile

Actions

Bug #57369

closed

cephadm: do not use "sudo" when checking host is reachable if user is root

Added by Adam King over 1 year ago. Updated over 1 year ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
% Done:

0%

Source:
Tags:
backport_processed
Backport:
quincy
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

For https://tracker.ceph.com/issues/55641 we made sure to not use sudo before all of our commands if the user is root. We also, to solve https://tracker.ceph.com/issues/51733, added a check that runs "sudo true" with a timeout first to make sure the host is online. The patch for the sudo issue missed this additional check command that we run. We now have

try:
            r = await conn.run('sudo true', check=True, timeout=5)
            r = await conn.run(cmd, input=stdin)

where the cmd str only includes sudo if the user is not root

sudo_prefix = "sudo " if self.mgr.ssh_user != 'root' else "" 
cmd = sudo_prefix + " ".join(quote(x) for x in cmd)

The additional "sudo true" should also only include sudo if user is not root.


Related issues 1 (0 open1 closed)

Copied to Orchestrator - Backport #57521: quincy: cephadm: do not use "sudo" when checking host is reachable if user is rootResolvedAdam KingActions
Actions

Also available in: Atom PDF