2
2
utils for discovery cluster
3
3
"""
4
4
from distutils .version import StrictVersion
5
- from django .utils .encoding import smart_text
5
+ from django .utils .encoding import smart_str
6
6
import re
7
7
from telnetlib import Telnet
8
8
@@ -35,7 +35,7 @@ def get_cluster_info(host, port, ignore_cluster_errors=False):
35
35
if len (version_list ) not in [2 , 3 ] or version_list [0 ] != b'VERSION' :
36
36
raise WrongProtocolData ('version' , res )
37
37
version = version_list [1 ]
38
- if StrictVersion (smart_text (version )) >= StrictVersion ('1.4.14' ):
38
+ if StrictVersion (smart_str (version )) >= StrictVersion ('1.4.14' ):
39
39
cmd = b'config get cluster\n '
40
40
else :
41
41
cmd = b'get AmazonElastiCache:cluster\n '
@@ -50,8 +50,8 @@ def get_cluster_info(host, port, ignore_cluster_errors=False):
50
50
return {
51
51
'version' : version ,
52
52
'nodes' : [
53
- '{0}:{1}' .format (smart_text (host ),
54
- smart_text (port ))
53
+ '{0}:{1}' .format (smart_str (host ),
54
+ smart_str (port ))
55
55
]
56
56
}
57
57
@@ -67,8 +67,8 @@ def get_cluster_info(host, port, ignore_cluster_errors=False):
67
67
try :
68
68
for node in ls [2 ].split (b' ' ):
69
69
host , ip , port = node .split (b'|' )
70
- nodes .append ('{0}:{1}' .format (smart_text (ip or host ),
71
- smart_text (port )))
70
+ nodes .append ('{0}:{1}' .format (smart_str (ip or host ),
71
+ smart_str (port )))
72
72
except ValueError :
73
73
raise WrongProtocolData (cmd , res )
74
74
return {
0 commit comments