Skip to content

Commit

Permalink
[MultiDB]: update sonic-db-cli output to redis-cli output format (son…
Browse files Browse the repository at this point in the history
…ic-net#59)

* [MultiDB]: update sonic-db-cli output to redis-cli output format
* add codes comments and handle review request
  • Loading branch information
dzhangalibaba authored and qiluo-msft committed Jan 16, 2020
1 parent ccc1307 commit 0b40999
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/swsssdk/scripts/sonic-db-cli
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,15 @@ else:
else:
client = dbconn.get_redis_client(dbname)
args = sys.argv[2:]
print client.execute_command(*args)
resp = client.execute_command(*args)
"""
sonic-db-cli output format mimic the non-tty mode output format from redis-cli
based on our usage in SONiC, None and list type output from python API needs to be modified
with these changes, it is enough for us to mimic redis-cli in SONiC so far since no application uses tty mode redis-cli output
"""
if resp is None:
print ""
elif isinstance(resp, list):
print " ".join(resp)
else:
print resp

0 comments on commit 0b40999

Please sign in to comment.