Skip to content

Commit

Permalink
add a shortcut for detecting whether a key upload has been done
Browse files Browse the repository at this point in the history
  • Loading branch information
bretth committed Dec 6, 2010
1 parent 22a88af commit 500a1a5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion woven/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#split out functions into function and _backend_functions
#or if the difference is marginal just use if statements
import os, socket, sys
import getpass

from django.utils import importlib

Expand Down Expand Up @@ -584,7 +585,12 @@ def upload_ssh_key(rollback=False):
Upload your ssh key for passwordless logins
"""
auth_keys = '/home/%s/.ssh/authorized_keys'% env.user
if not rollback:
if not rollback:
local_user = getpass.getuser()
host = socket.gethostname()
u = '@'.join([local_user,host])
u = 'ssh-key-uploaded-%s'% u
if not env.overwrite and server_state(u): return
if not exists('.ssh'):
run('mkdir .ssh')

Expand Down Expand Up @@ -614,6 +620,7 @@ def upload_ssh_key(rollback=False):
if env.verbosity:
print env.host, "UPLOADING SSH KEY if it doesn't already exist on host"
append(ssh_file,auth_keys) #append prevents uploading twice
set_server_state(u)
return
else:
if exists(auth_keys+'.wovenbak'):
Expand Down

0 comments on commit 500a1a5

Please sign in to comment.