Skip to content

Commit

Permalink
fix(OutputWatcher): use formatted string in log message
Browse files Browse the repository at this point in the history
Sometimes line for output  could contain '%s' or '0.0%' and this break
OutputWatcher log function with error:
```
18:42:47      msg = msg % self.args
18:42:47  ValueError: incomplete format

File "/home/ubuntu/scylla-cluster-tests/sdcm/remote/libssh2_client/__init__.py", line 449, in _process_output
      watcher.submit_line(data)
File "/home/ubuntu/scylla-cluster-tests/sdcm/remote/base.py", line 231, in submit_line
      self.log.debug("<%s>: " + line.rstrip('\n'), self.hostname)
Message: '<%s>: Percent Repaired       : 0.0%'
Arguments: ('10.4.0.228',)
```

Job: https://jenkins.scylladb.com/job/scylla-staging/job/abykov/job/longevity-twcs-4h-staging-test/20/execution/node/164/

Change format for log message info

self.log.debug("%s - %s', self.hostname, line)
  • Loading branch information
aleksbykov committed May 27, 2024
1 parent a470295 commit 43b9a6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sdcm/remote/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,13 @@ def submit(self, stream: str) -> list:

while '\n' in stream_buffer:
out_buf, rest_buf = stream_buffer.split('\n', 1)
self.log.debug("<%s>: " + out_buf, self.hostname)
self.log.debug("<%s>: %s", self.hostname, out_buf)
stream_buffer = rest_buf
self.len = len(stream) - len(stream_buffer)
return []

def submit_line(self, line: str):
self.log.debug("<%s>: " + line.rstrip('\n'), self.hostname)
self.log.debug("<%s>: %s", self.hostname, line.rstrip('\n'))


class LogWriteWatcher(StreamWatcher): # pylint: disable=too-few-public-methods
Expand Down

0 comments on commit 43b9a6e

Please sign in to comment.