Skip to content

Commit 03cf4e5

Browse files
mikliapkofruch
authored andcommitted
fix(logcollector): fix remote collect cmd to support non-bash shells
`>&` redirecting syntax has been replaced by `> file 2>&1` to support shells like sh. Such a shell is a default on Manager node deployed in Cloud. That makes impossible logs collect there. In terms of compatibility, `> file 2>&1` should behave consistently across different systems and shells.
1 parent 78c864c commit 03cf4e5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sdcm/logcollector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ def create_remote_storage_dir(self, node, path=''):
597597
def collect_log_remotely(node, cmd: str, log_filename: str) -> Optional[str]:
598598
if not node.remoter:
599599
return None
600-
collect_log_command = f"{cmd} >& '{log_filename}'"
600+
collect_log_command = f"{cmd} > '{log_filename}' 2>&1"
601601
node.remoter.run(collect_log_command, ignore_status=True, verbose=True)
602602
result = node.remoter.run(f"test -f '{log_filename}'", ignore_status=True)
603603
return log_filename if result.ok else None

0 commit comments

Comments
 (0)