diff --git a/pytest_fixtures/component/templatesync.py b/pytest_fixtures/component/templatesync.py index e6c93096a8b..e2945775ba6 100644 --- a/pytest_fixtures/component/templatesync.py +++ b/pytest_fixtures/component/templatesync.py @@ -66,7 +66,7 @@ def git_pub_key(session_target_sat, git_port): id = res.json()['id'] # add ssh key to known host session_target_sat.execute( - f'ssh-keyscan -4 -t rsa -p {git.ssh_port} {git.hostname} > {key_path}/known_hosts' + f"sudo -u foreman sh -c 'ssh-keyscan -t rsa -p {git.ssh_port} {git.hostname} >> {key_path}/known_hosts'" ) yield res = requests.delete(