Skip to content

Commit

Permalink
Problem: Crash when not using jailer due to inexisting folder
Browse files Browse the repository at this point in the history
Solution: don't try to create the file that we won't use anyway when not using jailer

This is a regression introduced in #454
  • Loading branch information
olethanh authored and hoh committed Nov 22, 2023
1 parent a2135bf commit d57e0aa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/aleph/vm/hypervisors/firecracker/microvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ def prepare_start(self):

async def save_configuration_file(self, config: FirecrackerConfig) -> Path:
with (
NamedTemporaryFile(delete=False) as tmp_config_file,
open(f"{self.jailer_path}/tmp/config.json", "wb") as tmp_jailer_config_file,
NamedTemporaryFile(delete=False)
if not self.use_jailer
else open(f"{self.jailer_path}/tmp/config.json", "wb") as config_file
):
config_file = tmp_config_file if not self.use_jailer else tmp_jailer_config_file
config_file.write(config.json(by_alias=True, exclude_none=True, indent=4).encode())
config_file.flush()
config_file_path = Path(config_file.name)
Expand Down

0 comments on commit d57e0aa

Please sign in to comment.