22utils for discovery cluster
33"""
44from distutils .version import StrictVersion
5- from django .utils .encoding import smart_text
5+ from django .utils .encoding import smart_str
66import re
77from telnetlib import Telnet
88
@@ -35,7 +35,7 @@ def get_cluster_info(host, port, ignore_cluster_errors=False):
3535 if len (version_list ) not in [2 , 3 ] or version_list [0 ] != b'VERSION' :
3636 raise WrongProtocolData ('version' , res )
3737 version = version_list [1 ]
38- if StrictVersion (smart_text (version )) >= StrictVersion ('1.4.14' ):
38+ if StrictVersion (smart_str (version )) >= StrictVersion ('1.4.14' ):
3939 cmd = b'config get cluster\n '
4040 else :
4141 cmd = b'get AmazonElastiCache:cluster\n '
@@ -50,8 +50,8 @@ def get_cluster_info(host, port, ignore_cluster_errors=False):
5050 return {
5151 'version' : version ,
5252 'nodes' : [
53- '{0}:{1}' .format (smart_text (host ),
54- smart_text (port ))
53+ '{0}:{1}' .format (smart_str (host ),
54+ smart_str (port ))
5555 ]
5656 }
5757
@@ -67,8 +67,8 @@ def get_cluster_info(host, port, ignore_cluster_errors=False):
6767 try :
6868 for node in ls [2 ].split (b' ' ):
6969 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 )))
7272 except ValueError :
7373 raise WrongProtocolData (cmd , res )
7474 return {
0 commit comments