]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-daemon: seek relative to the start of file 31892/head
authorMichael Fritch <mfritch@suse.com>
Tue, 26 Nov 2019 16:44:38 +0000 (09:44 -0700)
committerMichael Fritch <mfritch@suse.com>
Tue, 26 Nov 2019 16:55:52 +0000 (09:55 -0700)
python3 only allows seeks relative to the start of a text file

Signed-off-by: Michael Fritch <mfritch@suse.com>
src/ceph-daemon/ceph-daemon

index 37bb1f9465baa3c508d64fd132c799cebe2dc12f..0e592d8223a77fd1fefcb79df91ab4dfba96f888 100755 (executable)
@@ -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: