Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
5.3.0, 5.0.0
-
Fully Compatible
-
ALL
-
v6.0, v5.0
-
Sharding NYC 2022-05-30
-
1
Description
The following commands are user-facing but specify {strict: false} for how they parse their input. This means if the operator misspells an argument to the commands or includes a non-existing one, they won't always get an error. We should change these commands to be {strict: true} to protect against this.
- reshardCollection in src/mongo/s/request_types/reshard_collection.idl
- cleanupReshardCollection in src/mongo/s/request_types/cleanup_reshard_collection.idl
- abortReshardCollection in src/mongo/s/request_types/abort_reshard_collection.idl
- commitReshardCollection in src/mongo/s/request_types/commit_reshard_collection.idl
import pathlib |
import yaml |
|
def check_file(pathname): |
with open(pathname) as data: |
blob = yaml.safe_load(data) |
for (command, command_details) in blob.get("commands", {}).items(): |
if not command_details.get("strict", True): |
yield command_details["command_name"] |
|
for pathname in pathlib.Path().rglob("src/mongo/**/*.idl"): |
if str(pathname) == "src/mongo/idl/unittest.idl": |
continue |
for command in check_file(pathname): |
if not command.startswith("_"): |
print(f"{command} in {pathname}") |