Commit f5af391d authored by Michal Čihař's avatar Michal Čihař

Do not attempt to parse empty file

parent ef1f34a1
......@@ -250,13 +250,16 @@ def ssh(request):
# Read key data if it exists
if os.path.exists(RSA_KEY_FILE):
key_data = file(RSA_KEY_FILE).read()
key_type, key_fingerprint, key_id = key_data.strip().split(None, 2)
key = {
'key': key_data,
'type': key_type,
'fingerprint': key_fingerprint,
'id': key_id,
}
if len(key_data) > 0:
key_type, key_fingerprint, key_id = key_data.strip().split(None, 2)
key = {
'key': key_data,
'type': key_type,
'fingerprint': key_fingerprint,
'id': key_id,
}
else:
key = None
else:
key = None
......
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