Skip to content

Commit 9d6a557

Browse files
committed
fix: update bootstrap logic with confirmation
1 parent 4d7d3b0 commit 9d6a557

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

src/emd/commands/deploy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def deploy(
254254
region = get_current_region()
255255

256256
if region != LOCAL_REGION:
257-
smart_bootstrap_manager.auto_bootstrap_if_needed(region)
257+
smart_bootstrap_manager.auto_bootstrap_if_needed(region, skip_confirm)
258258

259259
if dockerfile_local_path:
260260
response = sdk_deploy(

src/emd/utils/smart_bootstrap.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def show_version_mismatch_warning(self, current_version: str, deployed_version:
121121
self.console.print() # Empty line for spacing
122122

123123

124-
def auto_bootstrap_if_needed(self, region: str) -> bool:
124+
def auto_bootstrap_if_needed(self, region: str, skip_confirm: bool = False) -> bool:
125125
"""
126126
Automatically run bootstrap if needed based on comprehensive infrastructure check
127127
Returns: True if bootstrap was run, False otherwise
@@ -145,18 +145,19 @@ def auto_bootstrap_if_needed(self, region: str) -> bool:
145145
# Infrastructure missing/incomplete OR version mismatch - ask for confirmation
146146
self.show_bootstrap_notification(current_version, deployed_version)
147147

148-
# Ask for user confirmation
149-
if deployed_version:
150-
# Update scenario
151-
confirm_msg = f"Update infrastructure from {deployed_version} to {current_version}?"
152-
else:
153-
# Initialize scenario
154-
confirm_msg = f"Initialize EMD infrastructure for version {current_version}?"
155-
156-
if not typer.confirm(confirm_msg, default=False):
157-
self.console.print("[yellow]Bootstrap cancelled. Infrastructure will not be updated.[/yellow]")
158-
self.console.print("[red]Deployment cannot proceed without compatible infrastructure.[/red]")
159-
raise typer.Exit(1)
148+
# Ask for user confirmation unless skip_confirm is True
149+
if not skip_confirm:
150+
if deployed_version:
151+
# Update scenario
152+
confirm_msg = f"Update infrastructure from {deployed_version} to {current_version}?"
153+
else:
154+
# Initialize scenario
155+
confirm_msg = f"Initialize EMD infrastructure for version {current_version}?"
156+
157+
if not typer.confirm(confirm_msg, default=False):
158+
self.console.print("[yellow]Bootstrap cancelled. Infrastructure will not be updated.[/yellow]")
159+
self.console.print("[red]Deployment cannot proceed without compatible infrastructure.[/red]")
160+
raise typer.Exit(1)
160161

161162
# User confirmed - proceed with bootstrap
162163
try:

0 commit comments

Comments
 (0)