Skip to content

Commit 79c7d3e

Browse files
committed
fix: properly setup DNS on WSL2
Signed-off-by: Jan Pokorný <JenomPokorny@gmail.com>
1 parent 30ce707 commit 79c7d3e

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

  • apps/agentstack-cli/src/agentstack_cli/commands

apps/agentstack-cli/src/agentstack_cli/commands/platform.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ async def start_cmd(
397397
install_dir.mkdir(parents=True, exist_ok=True)
398398
if current_wsl_image.startswith("http://") or current_wsl_image.startswith("https://"):
399399
with tempfile.NamedTemporaryFile(suffix=".wsl", delete=True, delete_on_close=False) as tmp:
400-
with console.status(f"Downloading WSL image from {current_wsl_image}...", spinner="dots"):
400+
with console.status("Downloading WSL distribution...", spinner="dots"):
401401
async with httpx.AsyncClient(follow_redirects=True) as client:
402402
async with client.stream("GET", current_wsl_image) as response:
403403
response.raise_for_status()
@@ -406,26 +406,25 @@ async def start_cmd(
406406
tmp.close()
407407
await run_command(
408408
["wsl.exe", "--import", vm_name, str(install_dir), tmp.name],
409-
"Importing a WSL distribution",
409+
"Importing WSL distribution",
410410
)
411411
else:
412412
await run_command(
413413
["wsl.exe", "--import", vm_name, str(install_dir), current_wsl_image],
414-
"Importing a WSL distribution",
414+
"Importing WSL distribution",
415415
)
416-
417-
await run_in_vm(
418-
vm_name,
419-
[
420-
"bash",
421-
"-c",
422-
"rm /etc/resolv.conf && mv /etc/resolv.conf-override /etc/resolv.conf && chattr +i /etc/resolv.conf",
423-
],
424-
"Setting up DNS configuration",
425-
check=False,
426-
)
427416
await run_command(["wsl.exe", "--terminate", vm_name], "Restarting Agent Stack VM")
428417
await run_in_vm(vm_name, ["/usr/bin/setsid", "-f", "/usr/bin/sleep", "infinity"], "Ensuring persistence of Agent Stack VM")
418+
await run_in_vm(
419+
vm_name,
420+
[
421+
"bash",
422+
"-c",
423+
"rm /etc/resolv.conf && cp /etc/resolv.conf-override /etc/resolv.conf && chattr +i /etc/resolv.conf",
424+
],
425+
"Setting up DNS configuration",
426+
check=False,
427+
)
429428
await run_in_vm(
430429
vm_name,
431430
[

0 commit comments

Comments
 (0)