diff options
author | Binbin <binloveplay1314@qq.com> | 2022-05-27 17:58:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-27 12:58:00 +0300 |
commit | 2a099d49d457239201b38c3ec97054a167658b6e (patch) | |
tree | df5a74aff673143a9c093db5e9f06b778a4bb910 /utils/generate-commands-json.py | |
parent | 6f7c1a8ce6861fb382f8313d07a6e2a13217a690 (diff) | |
download | redis-2a099d49d457239201b38c3ec97054a167658b6e.tar.gz |
Fix some commands key spec in json files (#10779)
There are some commands that has the wrong key specs.
This PR adds a key-spec related check in generate-command-code.py.
Check if the index is valid, or if there is an unused index.
The check result will look like:
```
[root]# python utils/generate-command-code.py
Processing json files...
Linking container command to subcommands...
Checking all commands...
command: RESTORE_ASKING may have unused key_spec
command: RENAME may have unused key_spec
command: PFDEBUG may have unused key_spec
command: WATCH key_specs missing flags
command: LCS arg: key2 key_spec_index error
command: RENAMENX may have unused key_spec
Error: There are errors in the commands check, please check the above logs.
```
The following commands have been fixed according to the check results:
- RESTORE ASKING: add missing arguments section (and history section)
- RENAME: newkey's key_spec_index should be 1
- PFDEBUG: add missing arguments (and change the arity from -3 to 3)
- WATCH: add missing key_specs flags: RO, like EXIST (it allow you to know the key exists, or is modified, but doesn't "leak" the data)
- LCS: key2 key_spec_index error, there is only one key-spec
- RENAMENX: newkey's key_spec_index should be 1
Diffstat (limited to 'utils/generate-commands-json.py')
-rwxr-xr-x | utils/generate-commands-json.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/utils/generate-commands-json.py b/utils/generate-commands-json.py index 8f812f224..23782ea22 100755 --- a/utils/generate-commands-json.py +++ b/utils/generate-commands-json.py @@ -1,10 +1,10 @@ #!/usr/bin/env python3 import argparse import json +import os import subprocess from collections import OrderedDict -from sys import argv, stdin -import os +from sys import argv def convert_flags_to_boolean_dict(flags): @@ -118,7 +118,8 @@ if __name__ == '__main__': stdout, stderr = p.communicate() commands = json.loads(stdout) - p = subprocess.Popen([args.cli, '-h', args.host, '-p', str(args.port), '--json', 'command', 'docs'], stdout=subprocess.PIPE) + p = subprocess.Popen([args.cli, '-h', args.host, '-p', str(args.port), '--json', 'command', 'docs'], + stdout=subprocess.PIPE) stdout, stderr = p.communicate() docs = json.loads(stdout) |