fix(deployment): resolve run() name shadowing in CLI modules

The module entry point `run = run_cmd` shadowed the imported subprocess
helper `run` from cli.helpers, causing TypeError on dispatch. Import as
`run_proc` and use a proper wrapper function for the module entry point.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-16 01:42:10 +00:00
parent 33e669cb1c
commit 695b26d5d2
4 changed files with 30 additions and 25 deletions

View File

@@ -4,7 +4,7 @@ import argparse
import os
import subprocess
import time
from cli.helpers import curl_status, run
from cli.helpers import curl_status, run as run_proc
REPO_CONFIGS = [
@@ -114,4 +114,5 @@ def run_cmd(args: argparse.Namespace, config: dict) -> int:
return 0
run = run_cmd
def run(args, config):
return run_cmd(args, config)

View File

@@ -5,7 +5,7 @@ import time
from cli.helpers import (
BASE_DIR, PROJECT_ROOT, GREEN, YELLOW, NC,
docker_compose, docker_image_exists, log_err, log_info, log_ok, log_warn,
pull_with_retry, resolve_services, run,
pull_with_retry, resolve_services, run as run_proc,
)
@@ -17,7 +17,7 @@ def run_cmd(args: argparse.Namespace, config: dict) -> int:
node_tag = base_images["node-deps"]["tag"]
if not docker_image_exists(node_tag):
log_warn(f"Building {node_tag} (required by all Node.js frontends)...")
result = run([
result = run_proc([
"docker", "build",
"-f", str(BASE_DIR / base_images["node-deps"]["dockerfile"]),
"-t", node_tag, str(PROJECT_ROOT),
@@ -78,7 +78,7 @@ def run_cmd(args: argparse.Namespace, config: dict) -> int:
all_ok = True
for svc in services:
log_info(f"Building {svc}...")
result = run(docker_compose("build", svc))
result = run_proc(docker_compose("build", svc))
if result.returncode != 0:
log_err(f"Failed: {svc}")
all_ok = False
@@ -89,7 +89,7 @@ def run_cmd(args: argparse.Namespace, config: dict) -> int:
break
else:
log_info("Parallel build (uses more RAM)...")
result = run(docker_compose("build", "--parallel", *services))
result = run_proc(docker_compose("build", "--parallel", *services))
if result.returncode == 0:
build_ok = True
break
@@ -109,4 +109,6 @@ def run_cmd(args: argparse.Namespace, config: dict) -> int:
# Module entry point — called by loader.dispatch()
run = run_cmd
# NOTE: must not shadow the imported `run` from cli.helpers
def run(args, config):
return run_cmd(args, config)

View File

@@ -3,7 +3,7 @@
import argparse
import os
import shutil
from cli.helpers import PROJECT_ROOT, log_err, log_info, log_ok, run, run_check
from cli.helpers import PROJECT_ROOT, log_err, log_info, log_ok, run as run_proc, run_check
def run_cmd(args: argparse.Namespace, config: dict) -> int:
@@ -17,14 +17,14 @@ def run_cmd(args: argparse.Namespace, config: dict) -> int:
if not shutil.which(tool):
log_err(f"{tool} not found. Install: {install_msg}")
return 1
run([tool, "version" if tool == "go" else "--version"])
run_proc([tool, "version" if tool == "go" else "--version"])
log_info("Configuring Nexus Conan remote...")
run(["conan", "remote", "add", "nexus", nexus_url, "--force"])
run_proc(["conan", "remote", "add", "nexus", nexus_url, "--force"])
run_check(["conan", "remote", "login", "nexus", nexus_user, "--password", nexus_pass])
run(["conan", "remote", "disable", "conancenter"])
run(["conan", "remote", "enable", "conancenter"])
run(["conan", "remote", "update", "nexus", "--index", "0"])
run_proc(["conan", "remote", "disable", "conancenter"])
run_proc(["conan", "remote", "enable", "conancenter"])
run_proc(["conan", "remote", "update", "nexus", "--index", "0"])
if not args.skip_native:
log_info("Building testcontainers-native/0.1.0 (C shared library)...")
@@ -53,4 +53,5 @@ def run_cmd(args: argparse.Namespace, config: dict) -> int:
return 0
run = run_cmd
def run(args, config):
return run_cmd(args, config)

View File

@@ -4,7 +4,7 @@ import argparse
import json
import os
import subprocess
from cli.helpers import curl_status, log_err, run
from cli.helpers import curl_status, log_err, run as run_proc
def run_cmd(args: argparse.Namespace, config: dict) -> int:
@@ -42,16 +42,16 @@ def run_cmd(args: argparse.Namespace, config: dict) -> int:
return 1
# Enable anonymous access
run(["curl", "-sf", "-X", "PUT", f"{nexus_url}/service/rest/v1/security/anonymous",
"-u", auth, "-H", "Content-Type: application/json",
"-d", '{"enabled":true,"userId":"anonymous","realmName":"NexusAuthorizingRealm"}'])
run_proc(["curl", "-sf", "-X", "PUT", f"{nexus_url}/service/rest/v1/security/anonymous",
"-u", auth, "-H", "Content-Type: application/json",
"-d", '{"enabled":true,"userId":"anonymous","realmName":"NexusAuthorizingRealm"}'])
nlog("Anonymous access enabled")
if not args.ci:
# Docker + npm token realms
run(["curl", "-sf", "-X", "PUT", f"{nexus_url}/service/rest/v1/security/realms/active",
"-u", auth, "-H", "Content-Type: application/json",
"-d", '["NexusAuthenticatingRealm","DockerToken","NpmToken"]'])
run_proc(["curl", "-sf", "-X", "PUT", f"{nexus_url}/service/rest/v1/security/realms/active",
"-u", auth, "-H", "Content-Type: application/json",
"-d", '["NexusAuthenticatingRealm","DockerToken","NpmToken"]'])
nlog("Docker + npm Bearer Token realms enabled")
# Docker hosted repo
@@ -75,9 +75,9 @@ def run_cmd(args: argparse.Namespace, config: dict) -> int:
return 1
else:
# CI: npm token realm only
run(["curl", "-sf", "-X", "PUT", f"{nexus_url}/service/rest/v1/security/realms/active",
"-u", auth, "-H", "Content-Type: application/json",
"-d", '["NexusAuthenticatingRealm","NpmToken"]'])
run_proc(["curl", "-sf", "-X", "PUT", f"{nexus_url}/service/rest/v1/security/realms/active",
"-u", auth, "-H", "Content-Type: application/json",
"-d", '["NexusAuthenticatingRealm","NpmToken"]'])
# npm repos (hosted, proxy, group)
npm_repos = [
@@ -130,4 +130,5 @@ def run_cmd(args: argparse.Namespace, config: dict) -> int:
return 0
run = run_cmd
def run(args, config):
return run_cmd(args, config)