summaryrefslogtreecommitdiffstats
path: root/GitAutoDeploy.py
diff options
context:
space:
mode:
authorAlexander Kjeldaas <ak@formalprivacy.com>2015-06-06 23:25:46 +0000
committerAlexander Kjeldaas <ak@formalprivacy.com>2015-06-06 23:25:46 +0000
commitb3b13ae857da073bffd27bfabc47f3e622d369c9 (patch)
treeccfd67adf71bc3d6696c0b69a9c2d3569cef89ae /GitAutoDeploy.py
parentc88ae14185b8d829eeb6d099f49867d37f7723d5 (diff)
downloadGit-Auto-Deploy-b3b13ae857da073bffd27bfabc47f3e622d369c9.zip
Git-Auto-Deploy-b3b13ae857da073bffd27bfabc47f3e622d369c9.tar.gz
Git-Auto-Deploy-b3b13ae857da073bffd27bfabc47f3e622d369c9.tar.bz2
Added --ssh-keyscan option.
Diffstat (limited to 'GitAutoDeploy.py')
-rwxr-xr-xGitAutoDeploy.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/GitAutoDeploy.py b/GitAutoDeploy.py
index 6a6afc8..5aaebae 100755
--- a/GitAutoDeploy.py
+++ b/GitAutoDeploy.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-import json, urlparse, sys, os, signal, socket
+import json, urlparse, sys, os, signal, socket, re
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from subprocess import call
from threading import Timer
@@ -177,6 +177,9 @@ class GitAutoDeployMain:
GitAutoDeploy.quiet = True
if(arg == '-q' or arg == '--quiet'):
GitAutoDeploy.quiet = True
+ if(arg == '--ssh-keyscan'):
+ print 'Scanning repository hosts for ssh keys...'
+ self.ssh_key_scan()
if(arg == '--force'):
print '[KILLER MODE] Warning: The --force option will try to kill any process ' \
'using %s port. USE AT YOUR OWN RISK' %GitAutoDeploy.getConfig()['port']
@@ -204,6 +207,18 @@ class GitAutoDeployMain:
self.debug_diagnosis()
sys.exit(1)
+ def ssh_key_scan(self):
+ for repository in GitAutoDeploy.getConfig()['repositories']:
+ url = repository['url']
+ print "Scanning repository: %s" % url
+ m = re.match('.*@(.*?):', url)
+ if(m != None):
+ port = repository['port']
+ port = '' if port == None else ('-p' + port)
+ call(['ssh-keyscan -t ecdsa,rsa ' + port + ' ' + m.group(1) + ' >> $HOME/.ssh/known_hosts'], shell=True)
+ else:
+ print 'Could not find regexp match in path: %s' % url
+
def kill_them_all(self):
pid = self.get_pid_on_port(GitAutoDeploy.getConfig()['port'])
if pid == False: