frostfs-testlib/src/neofs_testlib/shell/command_inspectors.py
Vladimir Domnich a750dfd148 [#9] Implement hosting package
Package defines interface for host management and provides implementation
for docker host (local or remote). Other hosts can be added via plugins.

Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
2022-10-14 16:36:29 +04:00

13 lines
360 B
Python

from neofs_testlib.shell.interfaces import CommandInspector
class SudoInspector(CommandInspector):
"""Prepends command with sudo.
If command is already prepended with sudo, then has no effect.
"""
def inspect(self, command: str) -> str:
if not command.startswith("sudo"):
return f"sudo {command}"
return command