Skip to content

Commit

Permalink
python: cbl_vmm: Harden against known_hosts not existing
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
  • Loading branch information
nathanchance committed Jan 3, 2025
1 parent e40cd4a commit fcaaac6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/scripts/cbl_vmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,9 @@ def run(self):
self._shared_folder.mkdir(exist_ok=True, parents=True)

# Clear any previous hosts using the chosen SSH port.
lib.utils.run(['ssh-keygen', '-R', f"[localhost]:{self.ssh_port}"], show_cmd=True)
Path.home().joinpath('.ssh/known_hosts.old').unlink(missing_ok=True)
if Path.home().joinpath('.ssh/known_hosts').exists():
lib.utils.run(['ssh-keygen', '-R', f"[localhost]:{self.ssh_port}"], show_cmd=True)
Path.home().joinpath('.ssh/known_hosts.old').unlink(missing_ok=True)

# Python recommends full paths with subprocess.Popen() calls
lib.utils.print_cmd(virtiofsd_cmd)
Expand Down

0 comments on commit fcaaac6

Please sign in to comment.