Ensure SSH git clone doesn't prompt for user

This patchset adds additional options to the git SSH command
to ensure that no prompt is required to perform the  clone.
This is needed for automation purposes. (For background when
first trying to clone something via SSH the client asks the
user whether they want to add the host to the hosts files --
this skips that check).

Change-Id: I752a354c5616f40eb8a0dbcb8606370654cabe14
This commit is contained in:
Felipe Monteiro 2018-07-12 20:35:03 +01:00
parent f35e56d777
commit 1480a05b82
1 changed files with 4 additions and 2 deletions

View File

@ -69,8 +69,10 @@ def git_clone(repo_url, ref='master', proxy_server=None, auth_method=None):
'the SSH key under CONF.ssh_key_path was not found.')
raise source_exceptions.GitSSHException(CONF.ssh_key_path)
ssh_cmd = ('ssh -i {} -o ConnectionAttempts=20 -o ConnectTimeout=10'
.format(os.path.expanduser(CONF.ssh_key_path)))
ssh_cmd = (
'ssh -i {} -o ConnectionAttempts=20 -o ConnectTimeout=10 -o '
'StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'.format(
os.path.expanduser(CONF.ssh_key_path)))
env_vars.update({'GIT_SSH_COMMAND': ssh_cmd})
else:
LOG.debug(