Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
define ssh_keygen earlier
  • Loading branch information
guykisel committed Jul 21, 2017
commit a947e9eadd396b0d004ff65370a2b80b9e8e8411
21 changes: 11 additions & 10 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@
REVIEWS_IN_PROGRESS = dict()
SSH_LOCK = threading.Lock()


def ssh_keygen():
time.sleep(random.randint(1, 10))
while not os.path.exists(SSH_FILE_PATH):
try:
subprocess.check_call(['ssh-keygen', '-t', 'rsa', '-b', '2048', '-f', SSH_FILE_PATH])
except Exception:
traceback.print_exc()
time.sleep(random.randint(1, 10))


TRUSTED = os.environ.get('TRUSTED', '').lower().strip() in ['true', 'yes', '1']
if TRUSTED:
ssh_keygen()
Expand Down Expand Up @@ -77,16 +88,6 @@ def clone_dotfiles(url, org, tempdir, token):
return clone(clone_url, dotfile_path, token)


def ssh_keygen():
time.sleep(random.randint(1, 10))
while not os.path.exists(SSH_FILE_PATH):
try:
subprocess.check_call(['ssh-keygen', '-t', 'rsa', '-b', '2048', '-f', SSH_FILE_PATH])
except Exception:
traceback.print_exc()
time.sleep(random.randint(1, 10))


def ssh_setup(url, token):
with SSH_LOCK:
if not url or url in ['http://github.com', 'https://github.com']:
Expand Down