fix: chdir to repo root before create_operation in restart
The spec's "stack:" value is a relative path that must resolve from the repo root. stack_is_external() checks Path(stack).exists() from cwd, which fails when cwd isn't the repo root. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>afd-dumpster-local-testing
parent
2484abfcce
commit
0ac886bf95
|
|
@ -397,7 +397,14 @@ def restart(ctx, stack_path, spec_file, config_file, force, expected_ip, image):
|
||||||
print("\n[2/4] Hostname unchanged, skipping DNS verification")
|
print("\n[2/4] Hostname unchanged, skipping DNS verification")
|
||||||
|
|
||||||
# Step 3: Sync deployment directory with spec
|
# Step 3: Sync deployment directory with spec
|
||||||
|
# The spec's "stack:" value is often a relative path (e.g.
|
||||||
|
# "stack-orchestrator/stacks/dumpster") that must resolve from the
|
||||||
|
# repo root. Change cwd so stack_is_external() sees it correctly.
|
||||||
print("\n[3/4] Syncing deployment directory...")
|
print("\n[3/4] Syncing deployment directory...")
|
||||||
|
import os
|
||||||
|
|
||||||
|
prev_cwd = os.getcwd()
|
||||||
|
os.chdir(repo_root)
|
||||||
deploy_ctx = make_deploy_context(ctx)
|
deploy_ctx = make_deploy_context(ctx)
|
||||||
create_operation(
|
create_operation(
|
||||||
deployment_command_context=deploy_ctx,
|
deployment_command_context=deploy_ctx,
|
||||||
|
|
@ -407,6 +414,7 @@ def restart(ctx, stack_path, spec_file, config_file, force, expected_ip, image):
|
||||||
network_dir=None,
|
network_dir=None,
|
||||||
initial_peers=None,
|
initial_peers=None,
|
||||||
)
|
)
|
||||||
|
os.chdir(prev_cwd)
|
||||||
|
|
||||||
# Reload deployment context with updated spec
|
# Reload deployment context with updated spec
|
||||||
deployment_context.init(deployment_context.deployment_dir)
|
deployment_context.init(deployment_context.deployment_dir)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue