forked from TrueCloudLab/frostfs-testlib
Support of custom version parameter instead of --version for all bins
This commit is contained in:
parent
40fa2c24cc
commit
c0a25ab699
1 changed files with 5 additions and 1 deletions
|
@ -40,16 +40,20 @@ def get_remote_binaries_versions(hosting: Hosting) -> dict[str, str]:
|
||||||
for service_config in host.config.services:
|
for service_config in host.config.services:
|
||||||
exec_path = service_config.attributes.get("exec_path")
|
exec_path = service_config.attributes.get("exec_path")
|
||||||
requires_check = service_config.attributes.get("requires_version_check", "true")
|
requires_check = service_config.attributes.get("requires_version_check", "true")
|
||||||
|
version_parameter = service_config.attributes.get("custom_version_parameter", "--version")
|
||||||
if exec_path:
|
if exec_path:
|
||||||
binary_path_by_name[service_config.name] = {
|
binary_path_by_name[service_config.name] = {
|
||||||
"exec_path": exec_path,
|
"exec_path": exec_path,
|
||||||
"check": requires_check.lower() == "true",
|
"check": requires_check.lower() == "true",
|
||||||
|
"version_parameter": version_parameter,
|
||||||
}
|
}
|
||||||
for cli_config in host.config.clis:
|
for cli_config in host.config.clis:
|
||||||
requires_check = cli_config.attributes.get("requires_version_check", "true")
|
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] = {
|
binary_path_by_name[cli_config.name] = {
|
||||||
"exec_path": cli_config.exec_path,
|
"exec_path": cli_config.exec_path,
|
||||||
"check": requires_check.lower() == "true",
|
"check": requires_check.lower() == "true",
|
||||||
|
"version_parameter": version_parameter,
|
||||||
}
|
}
|
||||||
|
|
||||||
shell = host.get_shell()
|
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():
|
for binary_name, binary in binary_path_by_name.items():
|
||||||
try:
|
try:
|
||||||
binary_path = binary["exec_path"]
|
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"]}
|
versions_at_host[binary_name] = {"version": _parse_version(result.stdout), "check": binary["check"]}
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.error(f"Cannot get version for {binary_path} because of\n{exc}")
|
logger.error(f"Cannot get version for {binary_path} because of\n{exc}")
|
||||||
|
|
Loading…
Reference in a new issue