swift-drive-audit broken on python 3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Object Storage (swift) |
Fix Released
|
High
|
Unassigned |
Bug Description
On python3, swift-drive-audit bombs out pretty quickly with something like
Traceback (most recent call last):
File ".../swift/
f.
io.Unsupporte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".../bin/
exec(
File ".../bin/
errors = get_errors(
File ".../bin/
for line in backward(f):
File ".../swift/
f.
io.Unsupporte
Per the docs [1],
> In text files (those opened without a `b` in the mode string), only
> seeks relative to the beginning of the file are allowed ...
... so I guess we need to open /var/log/kern.log et al. in binary mode. Now to figure out what an appropriate encoding would be...
[1] https:/
Reviewed: https:/ /review. opendev. org/688326 /git.openstack. org/cgit/ openstack/ swift/commit/ ?id=405a2b2a558 66b74f196ad81ea afedeee4615fa8
Committed: https:/
Submitter: Zuul
Branch: master
commit 405a2b2a55866b7 4f196ad81eaafed eee4615fa8
Author: Tim Burke <email address hidden>
Date: Sun Oct 13 21:55:54 2019 -0700
py3: Fix swift-drive-audit
Walking through the kernel logs backwards requires that we open them
in binary mode. Add a new option to allow users to specify which
encoding should be used to interpret those logs; default to the same
encoding that open() uses for its default.
Change-Id: Iae332bb58388b5 521445e75beba6e e2e9f06bfa6
Closes-Bug: #1847955