diff options
author | Oliver Poignant <oliver@poignant.se> | 2015-06-08 13:32:59 +0200 |
---|---|---|
committer | Oliver Poignant <oliver@poignant.se> | 2015-06-08 13:32:59 +0200 |
commit | b002375aa175d289d00a6c1343edf34eba766ee2 (patch) | |
tree | 9c603ff2dc64edf7e7b109d53c4655c60991419a /GitAutoDeploy.py | |
parent | c88ae14185b8d829eeb6d099f49867d37f7723d5 (diff) | |
parent | ca8b450e07639f88bdbdbf078182fe129b1078a3 (diff) | |
download | Git-Auto-Deploy-b002375aa175d289d00a6c1343edf34eba766ee2.zip Git-Auto-Deploy-b002375aa175d289d00a6c1343edf34eba766ee2.tar.gz Git-Auto-Deploy-b002375aa175d289d00a6c1343edf34eba766ee2.tar.bz2 |
Merge pull request #26 from alexanderkjeldaas/master
Dockerfile support
Diffstat (limited to 'GitAutoDeploy.py')
-rwxr-xr-x | GitAutoDeploy.py | 17 |
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: |