refactor: rework status fetching to make it more readable

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
dw-0
2024-05-04 00:20:53 +02:00
parent 27455dfc64
commit 750bf1caaf
3 changed files with 58 additions and 116 deletions

View File

@@ -35,13 +35,18 @@ from utils.git_utils import (
from utils.logger import Logger
def get_client_status(client: BaseWebClient) -> str:
return get_install_status_webui(
def get_client_status(
client: BaseWebClient, fetch_remote: bool = False
) -> Dict[Literal["status", "local", "remote"], str]:
status = get_install_status_webui(
client.client_dir,
NGINX_SITES_AVAILABLE.joinpath(client.name),
NGINX_CONFD.joinpath("upstreams.conf"),
NGINX_CONFD.joinpath("common_vars.conf"),
)
local = get_local_client_version(client)
remote = get_remote_client_version(client) if fetch_remote else None
return {"status": status, "local": local, "remote": remote}
def get_client_config_status(