diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-11-08 09:31:10 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-11-08 09:31:10 +0200 |
commit | edac7f326c8138d7377d595a3cf26f7f3d36b0fb (patch) | |
tree | 109e9e973e69445726511309a5d07c53b80e7bbf /subplot | |
parent | 89db59788108fc68325a57e5374f7fdfa0ed269c (diff) | |
download | debian-ansible-edac7f326c8138d7377d595a3cf26f7f3d36b0fb.tar.gz |
fix(subplot/qemumgr.py): use known hosts file to avoid warning
"Host key added" warning was always happening in the ssh output, and
it's annoying. This avoids it.
Diffstat (limited to 'subplot')
-rwxr-xr-x | subplot/qemumgr.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/subplot/qemumgr.py b/subplot/qemumgr.py index 0550bdb..bfc3f24 100755 --- a/subplot/qemumgr.py +++ b/subplot/qemumgr.py @@ -8,8 +8,7 @@ import shlex import shutil import signal import subprocess - -# import tempfile +import tempfile import time @@ -37,6 +36,9 @@ class QemuSystem: self._port = None self._pid = None + fd, self._knownhosts = tempfile.mkstemp() + os.close(fd) + def _join(self, *names): return os.path.join(self._dirname, *names) @@ -169,7 +171,7 @@ class QemuSystem: str(self._port), "-l", self._username, - "-ouserknownhostsfile=/dev/null", + f"-ouserknownhostsfile={self._knownhosts}", "-ostricthostkeychecking=accept-new", "-opasswordauthentication=no", ] |