fix: keep cwd at repo root through entire restart, revert try/except

The stack path in spec.yml is relative — both create_operation and
up_operation need cwd at the repo root for stack_is_external() to
resolve it. Move os.chdir(prev_cwd) to after up_operation completes
instead of between the two operations.

Reverts the SystemExit catch in call_stack_deploy_start — the root
cause was cwd, not the hook.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
A. F. DudleyandClaude Opus 4.6 committed 2026-03-20 15:54:46 +00:00
1 parent 32f6e57b70
commit 61afeb255c
2 files changed
+5 -15

No files matched your search

+4 -2
View File
@@ -414,8 +414,6 @@ def restart(ctx, stack_path, spec_file, config_file, force, expected_ip, image):
network_dir=None,
initial_peers=None,
)
os.chdir(prev_cwd)
# Reload deployment context with updated spec
deployment_context.init(deployment_context.deployment_dir)
ctx.obj = deployment_context
@@ -443,6 +441,10 @@ def restart(ctx, stack_path, spec_file, config_file, force, expected_ip, image):
image_overrides=image_overrides or None,
)
# Restore cwd after both create_operation and up_operation have run.
# Both need the relative stack path to resolve from repo_root.
os.chdir(prev_cwd)
print("\n=== Restart Complete ===")
print("Deployment updated via rolling update.")
if new_hostname and new_hostname != current_hostname: