summaryrefslogtreecommitdiffstats
path: root/gitautodeploy/gitautodeploy.py
diff options
context:
space:
mode:
authorOliver Poignant <oliver@poignant.se>2016-05-29 12:22:16 +0200
committerOliver Poignant <oliver@poignant.se>2016-05-29 12:22:22 +0200
commit9538eeae249c694feb3a2494804f36857e95c4af (patch)
treead5e0e85427df7ad1f30a98684439cf66ee3ff5f /gitautodeploy/gitautodeploy.py
parent208ebb8641ab1f9d58ea69377773216af36829f6 (diff)
downloadGit-Auto-Deploy-9538eeae249c694feb3a2494804f36857e95c4af.zip
Git-Auto-Deploy-9538eeae249c694feb3a2494804f36857e95c4af.tar.gz
Git-Auto-Deploy-9538eeae249c694feb3a2494804f36857e95c4af.tar.bz2
Renamed and fixed bug in keyscan feature
Diffstat (limited to 'gitautodeploy/gitautodeploy.py')
-rw-r--r--gitautodeploy/gitautodeploy.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/gitautodeploy/gitautodeploy.py b/gitautodeploy/gitautodeploy.py
index 8f3b172..c553362 100644
--- a/gitautodeploy/gitautodeploy.py
+++ b/gitautodeploy/gitautodeploy.py
@@ -130,22 +130,22 @@ class GitAutoDeploy(object):
logger = logging.getLogger()
for repository in self._config['repositories']:
+
+ if not 'url' in repository:
+ continue
- url = repository['url']
- logger.info("Scanning repository: %s" % url)
- m = re.match('.*@(.*?):', url)
+ logger.info("Scanning repository: %s" % repository['url'])
+ m = re.match('[^\@]+\@([^\:\/]+)(:(\d+))?', repository['url'])
if m is not None:
- port = repository['port']
- port = '' if port is None else ('-p' + port)
- ProcessWrapper().call(['ssh-keyscan -t ecdsa,rsa ' +
- port + ' ' +
- m.group(1) +
- ' >> ' +
- '$HOME/.ssh/known_hosts'], shell=True)
+ host = m.group(1)
+ port = m.group(3)
+ port_arg = '' if port is None else ('-p %s ' % port)
+ cmd = 'ssh-keyscan %s%s >> $HOME/.ssh/known_hosts' % (port_arg, host)
+ ProcessWrapper().call([cmd], shell=True)
else:
- logger.error('Could not find regexp match in path: %s' % url)
+ logger.error('Could not find regexp match in path: %s' % repository['url'])
def kill_conflicting_processes(self):
"""Attempt to kill any process already using the configured port."""
@@ -281,7 +281,7 @@ class GitAutoDeploy(object):
fileHandler.setFormatter(logFormatter)
logger.addHandler(fileHandler)
- if 'ssh-keygen' in self._config and self._config['ssh-keygen']:
+ if 'ssh-keyscan' in self._config and self._config['ssh-keyscan']:
logger.info('Scanning repository hosts for ssh keys...')
self.ssh_key_scan()