]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-create-keys: Misc Python 3 fixes 25532/head
authorJames Page <james.page@ubuntu.com>
Wed, 5 Dec 2018 16:29:43 +0000 (16:29 +0000)
committerNathan Cutler <ncutler@suse.com>
Thu, 13 Dec 2018 10:17:48 +0000 (11:17 +0100)
Use octal notation for file permissions.

Switch file() calls to open().

Signed-off-by: James Page <james.page@ubuntu.com>
(cherry picked from commit 107579196eb4b52b1965fec6dcc53eba9d314b97)

src/ceph-create-keys

index c14c02f28dc0dcadfef53d30e8bb6d832586ded1..41d76e1578dfdeca1baefb4c1571165dad9b7b70 100755 (executable)
@@ -91,12 +91,12 @@ def get_key(cluster, mon_id, wait_count=600):
     pathdir = os.path.dirname(path)
     if not os.path.exists(pathdir):
         os.makedirs(pathdir)
-        os.chmod(pathdir, 0770)
+        os.chmod(pathdir, 0o770)
         os.chown(pathdir, get_ceph_uid(), get_ceph_gid())
     while wait_count > 0:
         try:
-            with file(tmp, 'w') as f:
-                os.fchmod(f.fileno(), 0600)
+            with open(tmp, 'w') as f:
+                os.fchmod(f.fileno(), 0o600)
                 os.fchown(f.fileno(), get_ceph_uid(), get_ceph_gid())
                 LOG.info('Talking to monitor...')
 
@@ -201,13 +201,13 @@ def bootstrap_key(cluster, type_, wait_count=600):
     pathdir = os.path.dirname(path)
     if not os.path.exists(pathdir):
         os.makedirs(pathdir)
-        os.chmod(pathdir, 0770)
+        os.chmod(pathdir, 0o770)
         os.chown(pathdir, get_ceph_uid(), get_ceph_gid())
 
     while wait_count > 0:
         try:
-            with file(tmp, 'w') as f:
-                os.fchmod(f.fileno(), 0600)
+            with open(tmp, 'w') as f:
+                os.fchmod(f.fileno(), 0o600)
                 os.fchown(f.fileno(), get_ceph_uid(), get_ceph_gid())
                 LOG.info('Talking to monitor...')
                 returncode = subprocess.call(