Add known_hosts to bubblewrap jobir.work_root
Because we already have the known_hosts for all nodes we are planning
to use for a job, it makes sense to prime bubblewrap with this
information. This is specifically needed if using the verify_host
field in synchronize, because it relies on the ssh client knowning
have to read the default known_hosts file.
Change-Id: Ifdb3ac1eb7443beacb9277b5749d773b0c6aa4ad
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
diff --git a/zuul/executor/server.py b/zuul/executor/server.py
index c14625b..f2aedba 100644
--- a/zuul/executor/server.py
+++ b/zuul/executor/server.py
@@ -181,7 +181,9 @@
# Ansible
self.ansible_root = os.path.join(self.root, 'ansible')
os.makedirs(self.ansible_root)
- self.known_hosts = os.path.join(self.ansible_root, 'known_hosts')
+ ssh_dir = os.path.join(self.work_root, '.ssh')
+ os.mkdir(ssh_dir, 0o700)
+ self.known_hosts = os.path.join(ssh_dir, 'known_hosts')
self.inventory = os.path.join(self.ansible_root, 'inventory.yaml')
self.playbooks = [] # The list of candidate playbooks
self.playbook = None # A pointer to the candidate we have chosen