Commit 20bb67ce authored by Michal Čihař's avatar Michal Čihař

Use distutils to find if executable exists

This simplifes code and helps with old ssh-keygen, which doesn't detect
unknown parameters.
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent b7e0aabb
......@@ -20,6 +20,7 @@
import subprocess
import hashlib
from distutils.spawn import find_executable
import os
from django.utils.translation import ugettext as _
from django.contrib import messages
......@@ -228,18 +229,7 @@ def can_generate_key():
except OSError:
return False
try:
process = subprocess.Popen(
['ssh-keygen', '--help'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
env=get_clean_env(),
)
except OSError:
return False
# ssh-keygen does not support --help, it exits with 1
return process.wait() in (0, 1)
return find_executable('ssh-keygen') is not None
def create_ssh_wrapper():
......
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