From: Michael Fritch Date: Tue, 26 Nov 2019 16:44:38 +0000 (-0700) Subject: ceph-daemon: seek relative to the start of file X-Git-Tag: v15.1.0~735^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F31892%2Fhead;p=ceph.git ceph-daemon: seek relative to the start of file python3 only allows seeks relative to the start of a text file Signed-off-by: Michael Fritch --- diff --git a/src/ceph-daemon/ceph-daemon b/src/ceph-daemon/ceph-daemon index 37bb1f9465b..0e592d8223a 100755 --- a/src/ceph-daemon/ceph-daemon +++ b/src/ceph-daemon/ceph-daemon @@ -1145,9 +1145,9 @@ def command_bootstrap(): add_newline = False if os.path.exists(auth_keys_file): with open(auth_keys_file, 'r') as f: - f.seek(0, 2) + f.seek(0, os.SEEK_END) if f.tell() > 0: - f.seek(-1, 2) # go to last character + f.seek(f.tell()-1, os.SEEK_SET) # go to last char if f.read() != '\n': add_newline = True with open(auth_keys_file, 'a') as f: