252 lines
8.9 KiB
Diff
252 lines
8.9 KiB
Diff
From 4cef3c285b8246e606ac8947a5d4341cd82c81ac Mon Sep 17 00:00:00 2001
|
|
From: root <root@localhost.localdomain>
|
|
Date: Mon, 5 Sep 2022 09:05:03 +0000
|
|
Subject: [PATCH] py2 to py3
|
|
|
|
---
|
|
ceph_deploy/cli.py | 2 +-
|
|
ceph_deploy/hosts/debian/install.py | 2 +-
|
|
ceph_deploy/hosts/remotes.py | 2 +-
|
|
ceph_deploy/install.py | 2 +-
|
|
ceph_deploy/new.py | 2 +-
|
|
ceph_deploy/osd.py | 5 ++---
|
|
ceph_deploy/tests/test_conf.py | 2 +-
|
|
ceph_deploy/tests/unit/hosts/test_remotes.py | 2 +-
|
|
ceph_deploy/tests/unit/test_conf.py | 2 +-
|
|
ceph_deploy/tests/unit/util/test_net.py | 4 ++--
|
|
ceph_deploy/tests/util.py | 2 +-
|
|
ceph_deploy/util/log.py | 2 +-
|
|
ceph_deploy/util/net.py | 7 ++++---
|
|
ceph_deploy/util/pkg_managers.py | 2 +-
|
|
ceph_deploy/util/versions.py | 2 +-
|
|
15 files changed, 20 insertions(+), 20 deletions(-)
|
|
|
|
diff --git a/ceph_deploy/cli.py b/ceph_deploy/cli.py
|
|
index ccd6df8..2243fb6 100644
|
|
--- a/ceph_deploy/cli.py
|
|
+++ b/ceph_deploy/cli.py
|
|
@@ -30,7 +30,7 @@ def log_flags(args, logger=None):
|
|
logger = logger or LOG
|
|
logger.info('ceph-deploy options:')
|
|
|
|
- for k, v in args.__dict__.items():
|
|
+ for k, v in list(args.__dict__.items()):
|
|
if k.startswith('_'):
|
|
continue
|
|
logger.info(' %-30s: %s' % (k, v))
|
|
diff --git a/ceph_deploy/hosts/debian/install.py b/ceph_deploy/hosts/debian/install.py
|
|
index 1aa4431..fec1784 100644
|
|
--- a/ceph_deploy/hosts/debian/install.py
|
|
+++ b/ceph_deploy/hosts/debian/install.py
|
|
@@ -1,7 +1,7 @@
|
|
try:
|
|
from urllib.parse import urlparse
|
|
except ImportError:
|
|
- from urlparse import urlparse
|
|
+ from urllib.parse import urlparse
|
|
import logging
|
|
from ceph_deploy.util.paths import gpg
|
|
from ceph_deploy.util import net
|
|
diff --git a/ceph_deploy/hosts/remotes.py b/ceph_deploy/hosts/remotes.py
|
|
index 049ebff..3be9b4e 100644
|
|
--- a/ceph_deploy/hosts/remotes.py
|
|
+++ b/ceph_deploy/hosts/remotes.py
|
|
@@ -1,7 +1,7 @@
|
|
try:
|
|
import configparser
|
|
except ImportError:
|
|
- import ConfigParser as configparser
|
|
+ import configparser as configparser
|
|
import errno
|
|
import socket
|
|
import os
|
|
diff --git a/ceph_deploy/install.py b/ceph_deploy/install.py
|
|
index 12c5f79..ae6ef73 100644
|
|
--- a/ceph_deploy/install.py
|
|
+++ b/ceph_deploy/install.py
|
|
@@ -84,7 +84,7 @@ def detect_components(args, distro):
|
|
return defaults
|
|
else:
|
|
components = []
|
|
- for k, v in flags.items():
|
|
+ for k, v in list(flags.items()):
|
|
if getattr(args, k, False):
|
|
components.append(v)
|
|
# if we have some components selected from flags then return that,
|
|
diff --git a/ceph_deploy/new.py b/ceph_deploy/new.py
|
|
index 842117b..b561e2f 100644
|
|
--- a/ceph_deploy/new.py
|
|
+++ b/ceph_deploy/new.py
|
|
@@ -38,7 +38,7 @@ def ssh_copy_keys(hostname, username=None):
|
|
LOG.warning('could not connect via SSH')
|
|
|
|
# Create the key if it doesn't exist:
|
|
- id_rsa_pub_file = os.path.expanduser(u'~/.ssh/id_rsa.pub')
|
|
+ id_rsa_pub_file = os.path.expanduser('~/.ssh/id_rsa.pub')
|
|
id_rsa_file = id_rsa_pub_file.split('.pub')[0]
|
|
if not os.path.exists(id_rsa_file):
|
|
LOG.info('creating a passwordless id_rsa.pub key file')
|
|
diff --git a/ceph_deploy/osd.py b/ceph_deploy/osd.py
|
|
index cece242..1b46575 100644
|
|
--- a/ceph_deploy/osd.py
|
|
+++ b/ceph_deploy/osd.py
|
|
@@ -75,7 +75,7 @@ def osd_tree(conn, cluster):
|
|
loaded_json = json.loads(''.join(out))
|
|
# convert boolean strings to actual booleans because
|
|
# --format=json fails to do this properly
|
|
- for k, v in loaded_json.items():
|
|
+ for k, v in list(loaded_json.items()):
|
|
if v == 'true':
|
|
loaded_json[k] = True
|
|
elif v == 'false':
|
|
@@ -128,7 +128,7 @@ def osd_status_check(conn, cluster):
|
|
loaded_json = json.loads(''.join(out))
|
|
# convert boolean strings to actual booleans because
|
|
# --format=json fails to do this properly
|
|
- for k, v in loaded_json.items():
|
|
+ for k, v in list(loaded_json.items()):
|
|
if v == 'true':
|
|
loaded_json[k] = True
|
|
elif v == 'false':
|
|
@@ -372,7 +372,6 @@ def disk_list(args, cfg):
|
|
command,
|
|
)
|
|
for line in out:
|
|
- line = line.decode('utf-8')
|
|
if line.startswith('Disk /'):
|
|
distro.conn.logger.info(line)
|
|
|
|
diff --git a/ceph_deploy/tests/test_conf.py b/ceph_deploy/tests/test_conf.py
|
|
index 8d435df..23ecb6f 100644
|
|
--- a/ceph_deploy/tests/test_conf.py
|
|
+++ b/ceph_deploy/tests/test_conf.py
|
|
@@ -1,5 +1,5 @@
|
|
try:
|
|
- from cStringIO import StringIO
|
|
+ from io import StringIO
|
|
except ImportError:
|
|
from io import StringIO
|
|
from ceph_deploy import conf
|
|
diff --git a/ceph_deploy/tests/unit/hosts/test_remotes.py b/ceph_deploy/tests/unit/hosts/test_remotes.py
|
|
index 69ee4f7..d459763 100644
|
|
--- a/ceph_deploy/tests/unit/hosts/test_remotes.py
|
|
+++ b/ceph_deploy/tests/unit/hosts/test_remotes.py
|
|
@@ -1,5 +1,5 @@
|
|
try:
|
|
- from cStringIO import StringIO
|
|
+ from io import StringIO
|
|
except ImportError:
|
|
from io import StringIO
|
|
|
|
diff --git a/ceph_deploy/tests/unit/test_conf.py b/ceph_deploy/tests/unit/test_conf.py
|
|
index 685acbb..3280ec7 100644
|
|
--- a/ceph_deploy/tests/unit/test_conf.py
|
|
+++ b/ceph_deploy/tests/unit/test_conf.py
|
|
@@ -1,5 +1,5 @@
|
|
try:
|
|
- from cStringIO import StringIO
|
|
+ from io import StringIO
|
|
except ImportError:
|
|
from io import StringIO
|
|
from textwrap import dedent
|
|
diff --git a/ceph_deploy/tests/unit/util/test_net.py b/ceph_deploy/tests/unit/util/test_net.py
|
|
index 9c71bad..3c1120d 100644
|
|
--- a/ceph_deploy/tests/unit/util/test_net.py
|
|
+++ b/ceph_deploy/tests/unit/util/test_net.py
|
|
@@ -1,10 +1,10 @@
|
|
try:
|
|
from urllib.error import HTTPError
|
|
except ImportError:
|
|
- from urllib2 import HTTPError
|
|
+ from urllib.error import HTTPError
|
|
|
|
try:
|
|
- from StringIO import StringIO
|
|
+ from io import StringIO
|
|
except ImportError:
|
|
from io import StringIO
|
|
|
|
diff --git a/ceph_deploy/tests/util.py b/ceph_deploy/tests/util.py
|
|
index 50932da..ccecf66 100644
|
|
--- a/ceph_deploy/tests/util.py
|
|
+++ b/ceph_deploy/tests/util.py
|
|
@@ -24,7 +24,7 @@ class Empty(object):
|
|
instantiation.
|
|
"""
|
|
def __init__(self, **kw):
|
|
- for k, v in kw.items():
|
|
+ for k, v in list(kw.items()):
|
|
setattr(self, k, v)
|
|
|
|
|
|
diff --git a/ceph_deploy/util/log.py b/ceph_deploy/util/log.py
|
|
index c72303c..754f0bb 100644
|
|
--- a/ceph_deploy/util/log.py
|
|
+++ b/ceph_deploy/util/log.py
|
|
@@ -1,7 +1,7 @@
|
|
import logging
|
|
import sys
|
|
|
|
-BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
|
|
+BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = list(range(8))
|
|
|
|
COLORS = {
|
|
'WARNING': YELLOW,
|
|
diff --git a/ceph_deploy/util/net.py b/ceph_deploy/util/net.py
|
|
index fe30efe..9f56b2f 100644
|
|
--- a/ceph_deploy/util/net.py
|
|
+++ b/ceph_deploy/util/net.py
|
|
@@ -2,7 +2,8 @@ try:
|
|
from urllib.request import urlopen
|
|
from urllib.error import HTTPError
|
|
except ImportError:
|
|
- from urllib2 import urlopen, HTTPError
|
|
+ from urllib.request import urlopen
|
|
+ from urllib.error import HTTPError
|
|
|
|
from ceph_deploy import exc
|
|
import logging
|
|
@@ -85,11 +86,11 @@ def ip_addresses(conn, interface=None, include_loopback=False):
|
|
if interface is None:
|
|
target_ifaces = ifaces
|
|
else:
|
|
- target_ifaces = dict((k, v) for k, v in ifaces.items()
|
|
+ target_ifaces = dict((k, v) for k, v in list(ifaces.items())
|
|
if k == interface)
|
|
if not target_ifaces:
|
|
LOG.error('Interface {0} not found.'.format(interface))
|
|
- for info in target_ifaces.values():
|
|
+ for info in list(target_ifaces.values()):
|
|
for ipv4 in info.get('inet', []):
|
|
loopback = in_subnet('127.0.0.0/8', [ipv4.get('address')]) or ipv4.get('label') == 'lo'
|
|
if not loopback or include_loopback:
|
|
diff --git a/ceph_deploy/util/pkg_managers.py b/ceph_deploy/util/pkg_managers.py
|
|
index d05db5d..344d51c 100644
|
|
--- a/ceph_deploy/util/pkg_managers.py
|
|
+++ b/ceph_deploy/util/pkg_managers.py
|
|
@@ -2,7 +2,7 @@ import os
|
|
try:
|
|
from urllib.parse import urlparse
|
|
except ImportError:
|
|
- from urlparse import urlparse
|
|
+ from urllib.parse import urlparse
|
|
|
|
from ceph_deploy.lib import remoto
|
|
from ceph_deploy.util import templates
|
|
diff --git a/ceph_deploy/util/versions.py b/ceph_deploy/util/versions.py
|
|
index 810eb38..af2609d 100644
|
|
--- a/ceph_deploy/util/versions.py
|
|
+++ b/ceph_deploy/util/versions.py
|
|
@@ -34,7 +34,7 @@ class NormalizedVersion(object):
|
|
|
|
# safe int versions that remove non-numerical chars
|
|
# for example 'rc1' in a version like '1-rc1
|
|
- for name, value in version_map.items():
|
|
+ for name, value in list(version_map.items()):
|
|
if '-' in value: # get rid of garbage like -dev1 or -rc1
|
|
value = value.split('-')[0]
|
|
value = float(''.join(c for c in value if c.isdigit()) or 0)
|
|
--
|
|
2.33.0
|
|
|