]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: drop unicode alias
authorKefu Chai <kchai@redhat.com>
Sun, 31 Jan 2021 03:58:47 +0000 (11:58 +0800)
committerSebastian Wagner <sebastian.wagner@suse.com>
Mon, 22 Feb 2021 16:34:11 +0000 (17:34 +0100)
since we've dropped python 2 support

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 9380de2a8b888e1ec73407ea4b22a96c099b9de2)

src/cephadm/cephadm

index f4111c2dfbb89365296cf9771140c9814a5b0358..a905650791f8da3623ed53de79ddcda9cc069ba6 100755 (executable)
@@ -84,8 +84,6 @@ from threading import Thread, RLock
 from urllib.error import HTTPError
 from urllib.request import urlopen
 
-unicode = str
-
 cached_stdin = None
 
 DATEFMT = '%Y-%m-%dT%H:%M:%S.%fZ'
@@ -3174,7 +3172,7 @@ def wrap_ipv6(address):
     # it's already wrapped it'll not pass (like if it's a hostname) and trigger
     # the ValueError
     try:
-        if ipaddress.ip_address(unicode(address)).version == 6:
+        if ipaddress.ip_address(address).version == 6:
             return f"[{address}]"
     except ValueError:
         pass
@@ -3186,7 +3184,7 @@ def is_ipv6(address):
     # type: (str) -> bool
     address = unwrap_ipv6(address)
     try:
-        return ipaddress.ip_address(unicode(address)).version == 6
+        return ipaddress.ip_address(address).version == 6
     except ValueError:
         logger.warning("Address: {} isn't a valid IP address".format(address))
         return False
@@ -3246,8 +3244,8 @@ def prepare_mon_addresses(
         # make sure IP is configured locally, and then figure out the
         # CIDR network
         for net, ips in list_networks(ctx).items():
-            if ipaddress.ip_address(unicode(unwrap_ipv6(base_ip))) in \
-                    [ipaddress.ip_address(unicode(ip)) for ip in ips]:
+            if ipaddress.ip_address(unwrap_ipv6(base_ip)) in \
+                    [ipaddress.ip_address(ip) for ip in ips]:
                 mon_network = net
                 logger.info('Mon IP %s is in CIDR network %s' % (base_ip,
                                                                  mon_network))
@@ -4366,7 +4364,7 @@ def _parse_ipv6_route(routes, ips):
         ip = m[0][0]
         # find the network it belongs to
         net = [n for n in r.keys()
-               if ipaddress.ip_address(unicode(ip)) in ipaddress.ip_network(unicode(n))]
+               if ipaddress.ip_address(ip) in ipaddress.ip_network(n)]
         if net:
             r[net[0]].append(ip)