Project

General

Profile

Actions

Bug #46057

closed

qa/cephfs: run_as_user must args list instead of str

Added by Rishabh Dave almost 4 years ago. Updated almost 4 years ago.

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

0%

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

Description

Running self.mount_a.run_as_root(args='ls ~') leads to following error -

2020-06-17 23:02:30,000.000 INFO:__main__:  File "/home/rishabh/repos/ceph/minor/qa/tasks/cephfs/mount.py", line 542, in run_as_root
2020-06-17 23:02:30,000.000 INFO:__main__:    return self.run_as_user(**kwargs)
2020-06-17 23:02:30,000.000 INFO:__main__:  File "/home/rishabh/repos/ceph/minor/qa/tasks/cephfs/mount.py", line 535, in run_as_user
2020-06-17 23:02:30,000.000 INFO:__main__:    check_status=check_status, cwd=cwd)
2020-06-17 23:02:30,000.000 INFO:__main__:  File "../qa/tasks/vstart_runner.py", line 356, in run
2020-06-17 23:02:30,000.000 INFO:__main__:    return self._do_run(**kwargs)
2020-06-17 23:02:30,000.000 INFO:__main__:  File "../qa/tasks/vstart_runner.py", line 361, in _do_run
2020-06-17 23:02:30,000.000 INFO:__main__:    args = self._perform_checks_and_return_list_of_args(args, omit_sudo)
2020-06-17 23:02:30,000.000 INFO:__main__:  File "../qa/tasks/vstart_runner.py", line 346, in _perform_checks_and_return_list_of_args
2020-06-17 23:02:30,001.001 INFO:__main__:    raise RuntimeError(errmsg)
2020-06-17 23:02:30,001.001 INFO:__main__:RuntimeError: The entire command to executed as other user should be a single argument.
2020-06-17 23:02:30,001.001 INFO:__main__:args - ['sudo', '-u', 'root', '-s', '/bin/bash', '-c', 'ls', '~']

Because method _perform_checks_and_return_list_of_args splits all args which is not the correct way. Passing ls ~ leads to args ['sudo', '-u', 'root', '-s', '/bin/bash', '-c', 'ls', '~']. The correct arrangement of arguments should be ['sudo', '-u', 'root', '-s', '/bin/bash', '-c', 'ls ~'].

Actions #1

Updated by Patrick Donnelly almost 4 years ago

  • Status changed from Fix Under Review to Resolved
  • Target version set to v16.0.0
Actions

Also available in: Atom PDF