Change path type to str in fs utils remove command and fix for '*' at the

end of given path

Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
This commit is contained in:
Katarzyna Treder 2024-09-12 15:39:56 +02:00 committed by Katarzyna Treder
parent 96d7241423
commit 452000c03c

View File

@ -125,8 +125,12 @@ def move(source, destination, force: bool = False):
return TestRun.executor.run_expect_success(cmd)
def remove(path, force: bool = False, recursive: bool = False, ignore_errors: bool = False):
cmd = f"rm{' --force' if force else ''}{' --recursive' if recursive else ''} \"{path}\""
def remove(path: str, force: bool = False, recursive: bool = False, ignore_errors: bool = False):
cmd = "rm"
cmd += " --force" if force else ""
cmd += " --recursive" if recursive else ""
cmd += f" \"{path}\"" if not path.endswith("*") else f" \"{path[:-1]}\"*"
output = TestRun.executor.run(cmd)
if output.exit_code != 0 and not ignore_errors:
raise Exception(f"Could not remove file {path}."