From: James Page Date: Wed, 5 Dec 2018 16:29:43 +0000 (+0000) Subject: ceph-create-keys: Misc Python 3 fixes X-Git-Tag: v12.2.11~105^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F25532%2Fhead;p=ceph.git 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) --- 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(