summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2018-12-18 09:14:21 -0800
committerGitHub <noreply@github.com>2018-12-18 09:14:21 -0800
commit1244f6e3f9d38379124622ff4f0371914ce759ae (patch)
treed3878f9a7308f50ee3ed9e48465ce69514f3dcaf
parent4dc6fce15d5e2c56d785021f376652313cd5039e (diff)
parentaccbbdb2850f6286931fb82605702b672d2fd11e (diff)
downloadredis-py-1244f6e3f9d38379124622ff4f0371914ce759ae.tar.gz
Merge pull request #1077 from oranagra/fix_info_parsing
Re-fix the recently broken INFO parsing, see #1018
-rwxr-xr-xredis/client.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/redis/client.py b/redis/client.py
index df02f4e..4f08fbd 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -116,8 +116,12 @@ def parse_info(response):
for line in response.splitlines():
if line and not line.startswith('#'):
if line.find(':') != -1:
- # support keys that include ':' by using rsplit
- key, value = line.rsplit(':', 1)
+ # Split, the info fields keys and values.
+ # Note that the value may contain ':'. but the 'host:'
+ # pseudo-command is the only case where the key contains ':'
+ key, value = line.split(':', 1)
+ if key == 'cmdstat_host':
+ key, value = line.rsplit(':', 1)
info[key] = get_value(value)
else:
# if the line isn't splittable, append it to the "__raw__" key