Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MultiDB] sonic-db-cli should support EVAL operation, app script use … #58

Merged
merged 2 commits into from
Dec 18, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/swsssdk/scripts/sonic-db-cli
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ elif argc < 3:
print >> sys.stderr, msg
else:
dbname = sys.argv[1]
op = sys.argv[2]
dbconn = swsssdk.SonicV2Connector(use_unix_socket_path=False)
try:
dbconn.connect(dbname)
Expand All @@ -20,4 +21,10 @@ else:
print >> sys.stderr, msg
else:
client = dbconn.get_redis_client(dbname)
print client.execute_command(" ".join(sys.argv[2:]))
if op == 'EVAL':
lua_script = sys.argv[3]
numkeys = sys.argv[4]
keys_args = [] if numkeys == 0 else sys.argv[5:]
print client.execute_command(op, lua_script, numkeys, *keys_args)
else:
print client.execute_command(" ".join(sys.argv[2:]))
Copy link
Contributor

@qiluo-msft qiluo-msft Dec 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you unify both branches? execute_command is quite general for both cases. #Closed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DONE