From ee61e2df5164a7038cb31ca1b5c55b2f76c373e9 Mon Sep 17 00:00:00 2001 From: James Page Date: Wed, 5 Dec 2018 16:29:43 +0000 Subject: [PATCH] ceph-create-keys: Misc Python 3 fixes Use octal notation for file permissions. Switch file() calls to open(). Signed-off-by: James Page (cherry picked from commit 107579196eb4b52b1965fec6dcc53eba9d314b97) --- src/ceph-create-keys | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ceph-create-keys b/src/ceph-create-keys index c14c02f28dc0..41d76e1578df 100755 --- a/src/ceph-create-keys +++ b/src/ceph-create-keys @@ -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( -- 2.47.3