diff --git a/src/mcp_server_uyuni/server.py b/src/mcp_server_uyuni/server.py index 4ca96e6..c244f8c 100644 --- a/src/mcp_server_uyuni/server.py +++ b/src/mcp_server_uyuni/server.py @@ -1070,7 +1070,7 @@ async def add_system( payload["proxyId"] = proxy_id logger.info(f"adding system {host}") - async with httpx.AsyncClient(verify=False) as client: + async with httpx.AsyncClient(verify=CONFIG["UYUNI_MCP_SSL_VERIFY"]) as client: api_result = await call_uyuni_api( client=client, method="POST", api_path="/rhn/manager/api/system/bootstrapWithPrivateSshKey", @@ -1139,7 +1139,7 @@ async def remove_system(system_identifier: Union[str, int], ctx: Context, cleanu cleanup_type = "FORCE_DELETE" if cleanup else "NO_CLEANUP" - async with httpx.AsyncClient(verify=False) as client: + async with httpx.AsyncClient(verify=CONFIG["UYUNI_MCP_SSL_VERIFY"]) as client: api_result = await call_uyuni_api( client=client, method="POST", @@ -1486,7 +1486,7 @@ async def list_activation_keys(ctx: Context) -> List[Dict[str, str]]: """ list_keys_path = '/rhn/manager/api/activationkey/listActivationKeys' - async with httpx.AsyncClient(verify=False) as client: + async with httpx.AsyncClient(verify=CONFIG["UYUNI_MCP_SSL_VERIFY"]) as client: api_result = await call_uyuni_api( client=client, method="GET", @@ -1506,25 +1506,26 @@ async def list_activation_keys(ctx: Context) -> List[Dict[str, str]]: await ctx.warning(msg) return filtered_keys +@mcp.tool() async def get_unscheduled_errata(system_id: int, ctx: Context) -> List[Dict[str, Any]]: """ Provides a list of errata that are applicable to the system with the system_id - passed as parameter and have not ben scheduled yet. All elements in the result are patches that are applicable + passed as parameter and have not been scheduled yet. All elements in the result are patches that are applicable for the system. Args: - sid: The integer ID of the system for which we want to know the list of applicable errata. + system_id: The integer ID of the system for which we want to know the list of applicable errata. Returns: List[Dict[str, Any]]: A list of dictionaries with each dictionary defining a errata applicable to the system given as a parameter. - Retruns an empty dictionary if no applicable errata for the system are found. + Returns an empty dictionary if no applicable errata for the system are found. """ log_string = f"Getting list of unscheduled errata for system {system_id}" logger.info(log_string) await ctx.info(log_string) - async with httpx.AsyncClient(verify=False) as client: + async with httpx.AsyncClient(verify=CONFIG["UYUNI_MCP_SSL_VERIFY"]) as client: get_unscheduled_errata = "/rhn/manager/api/system/getUnscheduledErrata" payload = {'sid': str(system_id)} unscheduled_errata_result = await call_uyuni_api( @@ -1558,5 +1559,5 @@ def main_cli(): mcp.run(transport="stdio") else: # Defaults to stdio transport anyway - # But I explicitety state it here for clarity + # But I explicitly state it here for clarity mcp.run(transport="stdio")