|
15 | 15 | ) |
16 | 16 | from azext_aks_agent.agent.k8s.helm_manager import HelmManager |
17 | 17 | from azext_aks_agent.agent.llm_config_manager import LLMConfigManager |
18 | | -from azure.cli.core import get_default_cli |
19 | 18 | from azure.cli.core.azclierror import AzCLIError |
20 | 19 | from knack.log import get_logger |
21 | 20 | from kubernetes import client, config |
@@ -219,14 +218,15 @@ def get_agent_pods(self) -> Tuple[bool, Union[List[str], str]]: |
219 | 218 | all_pod_items = list(agent_pods.items) + list(mcp_pods.items) |
220 | 219 |
|
221 | 220 | # Create a pod_list-like object with combined items |
222 | | - class PodList: |
| 221 | + class PodList: # pylint: disable=too-few-public-methods |
223 | 222 | def __init__(self, items): |
224 | 223 | self.items = items |
225 | 224 | pod_list = PodList(all_pod_items) |
226 | 225 |
|
227 | 226 | if not pod_list.items: |
228 | 227 | error_msg = ( |
229 | | - f"No pods found with label selector '{AGENT_LABEL_SELECTOR}' or '{AKS_MCP_LABEL_SELECTOR}' in namespace '{self.namespace}'. " |
| 228 | + f"No pods found with label selector '{AGENT_LABEL_SELECTOR}' or " |
| 229 | + f"'{AKS_MCP_LABEL_SELECTOR}' in namespace '{self.namespace}'. " |
230 | 230 | f"This could mean:\n" |
231 | 231 | f" 1. The AKS agent is not deployed in the cluster\n" |
232 | 232 | f" 2. The namespace '{self.namespace}' does not exist\n" |
@@ -295,7 +295,8 @@ def __init__(self, items): |
295 | 295 | status_summary = "; ".join(status_details) if status_details else "all pods are in unknown state" |
296 | 296 |
|
297 | 297 | error_msg = ( |
298 | | - f"No running pods found with label selector '{AGENT_LABEL_SELECTOR}' or '{AKS_MCP_LABEL_SELECTOR}' in namespace '{self.namespace}'. " |
| 298 | + f"No running pods found with label selector '{AGENT_LABEL_SELECTOR}' or " |
| 299 | + f"'{AKS_MCP_LABEL_SELECTOR}' in namespace '{self.namespace}'. " |
299 | 300 | f"Found {len(pod_list.items)} pod(s) but none are in Running state: {status_summary}. " |
300 | 301 | f"The AKS agent pods may be starting up, failing to start, or experiencing issues." |
301 | 302 | ) |
@@ -401,7 +402,7 @@ def deploy_agent(self, chart_version: Optional[str] = None, |
401 | 402 |
|
402 | 403 | return False, output |
403 | 404 |
|
404 | | - def get_agent_status(self) -> Dict: |
| 405 | + def get_agent_status(self) -> Dict: # pylint: disable=too-many-locals |
405 | 406 | """ |
406 | 407 | Get the current status of AKS agent deployment. |
407 | 408 |
|
@@ -491,7 +492,7 @@ def get_agent_status(self) -> Dict: |
491 | 492 | all_pods = list(agent_pods.items) + list(mcp_pods.items) |
492 | 493 |
|
493 | 494 | # Create a pods-like object with combined items |
494 | | - class PodList: |
| 495 | + class PodList: # pylint: disable=too-few-public-methods |
495 | 496 | def __init__(self, items): |
496 | 497 | self.items = items |
497 | 498 | pods = PodList(all_pods) |
@@ -560,10 +561,9 @@ def check_llm_config_exists(self) -> bool: |
560 | 561 | logger.debug("LLM config secret '%s' not found in namespace '%s'", |
561 | 562 | self.llm_secret_name, self.namespace) |
562 | 563 | return False |
563 | | - else: |
564 | | - logger.error("Failed to check LLM config existence (API error %s): %s", |
565 | | - e.status, e) |
566 | | - raise |
| 564 | + logger.error("Failed to check LLM config existence (API error %s): %s", |
| 565 | + e.status, e) |
| 566 | + raise |
567 | 567 | except Exception as e: # pylint: disable=broad-exception-caught |
568 | 568 | logger.error("Unexpected error checking LLM config existence: %s", e) |
569 | 569 | raise AzCLIError(f"Failed to check LLM config existence: {e}") |
|
0 commit comments