diff --git a/esrally/rally.py b/esrally/rally.py index 95ae67bb2..c98c59db6 100644 --- a/esrally/rally.py +++ b/esrally/rally.py @@ -98,6 +98,9 @@ def supported_es_version(v): raise argparse.ArgumentTypeError(f"must be at least {min_es_version} but was {v}") return v + def revision(v): + return v.strip() + def add_track_source(subparser): track_source_group = subparser.add_mutually_exclusive_group() track_source_group.add_argument( @@ -114,6 +117,7 @@ def add_track_source(subparser): "--track-revision", help="Define a specific revision in the track repository that Rally should use.", default=None, + type=revision, ) # try to preload configurable defaults, but this does not work together with `--configuration-name` (which is undocumented anyway) @@ -295,6 +299,7 @@ def add_track_source(subparser): 'e.g. "@2013-07-27T10:37:00Z" (default: current). A combination of branch and timestamp is also possible,' 'e.g. "@feature-branch@2023-04-06T14:52:31Z".', default="current", + type=revision, ) # optimized for local usage, don't fetch sources build_parser.add_argument( "--target-os", @@ -313,6 +318,7 @@ def add_track_source(subparser): "--team-revision", help="Define a specific revision in the team repository that Rally should use.", default=None, + type=revision, ) build_parser.add_argument( "--team-path", @@ -355,6 +361,7 @@ def add_track_source(subparser): "--team-revision", help="Define a specific revision in the team repository that Rally should use.", default=None, + type=revision, ) download_parser.add_argument( "--team-path", @@ -399,6 +406,7 @@ def add_track_source(subparser): ' The timestamp must be specified as: "@ts" where "ts" must be a valid ISO 8601 timestamp, ' 'e.g. "@2013-07-27T10:37:00Z" (default: current).', default="current", + type=revision, ) # optimized for local usage, don't fetch sources # Intentionally undocumented as we do not consider Docker a fully supported option. install_parser.add_argument( @@ -416,6 +424,7 @@ def add_track_source(subparser): "--team-revision", help="Define a specific revision in the team repository that Rally should use.", default=None, + type=revision, ) install_parser.add_argument( "--team-path", @@ -571,6 +580,7 @@ def add_track_source(subparser): "--team-revision", help="Define a specific revision in the team repository that Rally should use.", default=None, + type=revision, ) race_parser.add_argument( @@ -591,6 +601,7 @@ def add_track_source(subparser): ' The timestamp must be specified as: "@ts" where "ts" must be a valid ISO 8601 timestamp, ' 'e.g. "@2013-07-27T10:37:00Z" (default: current).', default="current", + type=revision, ) # optimized for local usage, don't fetch sources add_track_source(race_parser) race_parser.add_argument(