Commit 30d5e969 authored by Tulio Ruiz's avatar Tulio Ruiz
Browse files

[FIX] Handle any error scanning the host.

If by any chance one of the possible hosts to scan is down or inaccessible we must warn the user instead of failing. If we continue there is a chance that the repo don't need any of the failing hosts, if it is needed will fail (which is expected at this point)
parent 6e25ceca
Pipeline #65226 canceled with stage
......@@ -245,7 +245,13 @@ def scan_keys(folder):
known_hosts = path.join(folder, 'known_hosts')
with open(known_hosts, 'a') as known_file:
for host in TO_SCAN:
try:
keys = subprocess.check_output(['ssh-keyscan', host], stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as error:
_logger.warn(('Could not scan % host, if you get any error cloning '
'from this provider, please try again later'), host)
_logger.warn('Error was: ', error.output)
else:
for line in utils.decode(keys).split('\n'):
clean = line.strip()
if clean:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment