Skip to content

Commit

Permalink
fix(logcollector): fix remote collect cmd to support non-bash shells
Browse files Browse the repository at this point in the history
`>&` 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.
  • Loading branch information
mikliapko authored and fruch committed Dec 22, 2024
1 parent 78c864c commit 03cf4e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sdcm/logcollector.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ def create_remote_storage_dir(self, node, path=''):
def collect_log_remotely(node, cmd: str, log_filename: str) -> Optional[str]:
if not node.remoter:
return None
collect_log_command = f"{cmd} >& '{log_filename}'"
collect_log_command = f"{cmd} > '{log_filename}' 2>&1"
node.remoter.run(collect_log_command, ignore_status=True, verbose=True)
result = node.remoter.run(f"test -f '{log_filename}'", ignore_status=True)
return log_filename if result.ok else None
Expand Down

0 comments on commit 03cf4e5

Please sign in to comment.