From c0a25ab699088a79c535aeded3b4150e922be5dd Mon Sep 17 00:00:00 2001 From: Yaroslava Lukoyanova Date: Thu, 18 Jan 2024 10:41:36 +0300 Subject: [PATCH] Support of custom version parameter instead of --version for all bins --- src/frostfs_testlib/utils/version_utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/frostfs_testlib/utils/version_utils.py b/src/frostfs_testlib/utils/version_utils.py index 42bde6d..75ce8a5 100644 --- a/src/frostfs_testlib/utils/version_utils.py +++ b/src/frostfs_testlib/utils/version_utils.py @@ -40,16 +40,20 @@ def get_remote_binaries_versions(hosting: Hosting) -> dict[str, str]: for service_config in host.config.services: exec_path = service_config.attributes.get("exec_path") requires_check = service_config.attributes.get("requires_version_check", "true") + version_parameter = service_config.attributes.get("custom_version_parameter", "--version") if exec_path: binary_path_by_name[service_config.name] = { "exec_path": exec_path, "check": requires_check.lower() == "true", + "version_parameter": version_parameter, } for cli_config in host.config.clis: requires_check = cli_config.attributes.get("requires_version_check", "true") + version_parameter = service_config.attributes.get("custom_version_parameter", "--version") binary_path_by_name[cli_config.name] = { "exec_path": cli_config.exec_path, "check": requires_check.lower() == "true", + "version_parameter": version_parameter, } shell = host.get_shell() @@ -57,7 +61,7 @@ def get_remote_binaries_versions(hosting: Hosting) -> dict[str, str]: for binary_name, binary in binary_path_by_name.items(): try: binary_path = binary["exec_path"] - result = shell.exec(f"{binary_path} --version") + result = shell.exec(f"{binary_path} {binary['version_parameter']}") versions_at_host[binary_name] = {"version": _parse_version(result.stdout), "check": binary["check"]} except Exception as exc: logger.error(f"Cannot get version for {binary_path} because of\n{exc}")