Archived
Fix pyright type errors across codebase
- Add pyrightconfig.json for pyright 1.1.408 TOML parsing workaround - Add NoReturn annotations to fatal() functions for proper type narrowing - Add None checks and assertions after require=True get_record() calls - Fix AttrDict class with __getattr__ for dynamic attribute access - Add type annotations and casts for Kubernetes client objects - Store compose config as DockerDeployer instance attributes - Filter None values from dotenv and environment mappings - Use hasattr/getattr patterns for optional container attributes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
cd3d908d0d
commit
dd856af2d3
@@ -138,6 +138,8 @@ def generate_helm_chart(
|
||||
"""
|
||||
|
||||
parsed_stack = get_parsed_stack_config(stack_path)
|
||||
if parsed_stack is None:
|
||||
error_exit(f"Failed to parse stack config: {stack_path}")
|
||||
stack_name = parsed_stack.get("name", stack_path)
|
||||
|
||||
# 1. Check Kompose availability
|
||||
@@ -185,22 +187,28 @@ def generate_helm_chart(
|
||||
compose_files = []
|
||||
for pod in pods:
|
||||
pod_file = get_pod_file_path(stack_path, parsed_stack, pod)
|
||||
if not pod_file.exists():
|
||||
error_exit(f"Pod file not found: {pod_file}")
|
||||
compose_files.append(pod_file)
|
||||
if pod_file is None:
|
||||
error_exit(f"Pod file path not found for pod: {pod}")
|
||||
pod_file_path = Path(pod_file) if isinstance(pod_file, str) else pod_file
|
||||
if not pod_file_path.exists():
|
||||
error_exit(f"Pod file not found: {pod_file_path}")
|
||||
compose_files.append(pod_file_path)
|
||||
if opts.o.debug:
|
||||
print(f"Found compose file: {pod_file.name}")
|
||||
print(f"Found compose file: {pod_file_path.name}")
|
||||
|
||||
# Add job compose files
|
||||
job_files = []
|
||||
for job in jobs:
|
||||
job_file = get_job_file_path(stack_path, parsed_stack, job)
|
||||
if not job_file.exists():
|
||||
error_exit(f"Job file not found: {job_file}")
|
||||
compose_files.append(job_file)
|
||||
job_files.append(job_file)
|
||||
if job_file is None:
|
||||
error_exit(f"Job file path not found for job: {job}")
|
||||
job_file_path = Path(job_file) if isinstance(job_file, str) else job_file
|
||||
if not job_file_path.exists():
|
||||
error_exit(f"Job file not found: {job_file_path}")
|
||||
compose_files.append(job_file_path)
|
||||
job_files.append(job_file_path)
|
||||
if opts.o.debug:
|
||||
print(f"Found job compose file: {job_file.name}")
|
||||
print(f"Found job compose file: {job_file_path.name}")
|
||||
|
||||
try:
|
||||
version = get_kompose_version()
|
||||
|
||||
@@ -18,6 +18,7 @@ import tempfile
|
||||
import os
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
from stack_orchestrator.util import get_yaml
|
||||
|
||||
|
||||
@@ -50,7 +51,7 @@ def get_release_name_from_chart(chart_dir: Path) -> str:
|
||||
def run_helm_job(
|
||||
chart_dir: Path,
|
||||
job_name: str,
|
||||
release: str = None,
|
||||
release: Optional[str] = None,
|
||||
namespace: str = "default",
|
||||
timeout: int = 600,
|
||||
verbose: bool = False,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import subprocess
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
from typing import List, Optional
|
||||
|
||||
|
||||
def check_kompose_available() -> bool:
|
||||
@@ -53,7 +53,7 @@ def get_kompose_version() -> str:
|
||||
|
||||
|
||||
def convert_to_helm_chart(
|
||||
compose_files: List[Path], output_dir: Path, chart_name: str = None
|
||||
compose_files: List[Path], output_dir: Path, chart_name: Optional[str] = None
|
||||
) -> str:
|
||||
"""
|
||||
Invoke kompose to convert Docker Compose files to a Helm chart.
|
||||
|
||||
Reference in New Issue
Block a user