summaryrefslogtreecommitdiff
path: root/0001-py2-to-py3.patch
blob: 666c4a1922411f377a65df133f24fe0376ebbc24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
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