Skip to content

Commit

Permalink
[FIX] apis.py: Adding new metod _ssh_keyscan to run the ssh-keyscan o…
Browse files Browse the repository at this point in the history
…ver the weblate-ssh server (OCA#484)

* [FIX] apis.py: Adding new metod _ssh_keyscan to run the ssh-keyscan over the weblate-ssh server (OCA#233)

* [REF] broken_deprecated: Use correct version format
 - After merge OCA/pylint-odoo#155 we had this unexpected wrong format version
  • Loading branch information
Jesus Zapata authored and bt-admin committed Oct 20, 2017
1 parent cd0137f commit 9bf4f57
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/test_repo/broken_deprecated/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name': 'Broken deprecated module for tests MQT',
'license': 'AGPL-3',
'author': 'Odoo Community Association (OCA)',
'version': '8.0.0.1.0.0',
'version': '8.0.1.0.0',
'depends': [
'base',
],
Expand Down
20 changes: 20 additions & 0 deletions travis/apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import base64
import os
import re
import subprocess
import tempfile
import time
import json
Expand Down Expand Up @@ -54,6 +56,24 @@ def __init__(self):
self.ssh = os.environ.get(
"WEBLATE_SSH", "ssh://user@webpage.com")
self.tempdir = os.path.join(tempfile.gettempdir(), 'weblate_api')
self._ssh_keyscan()

def _ssh_keyscan(self):
"""This method execute the command 'ssh-keysan' to avoid the
question when the command git clone is excecuted.
The question is like to:
'Are you sure you want to continue connecting (yes/no)?'"""
cmd = ['ssh-keyscan', '-p']
match = re.search(
r'(ssh\:\/\/\w+@(?P<host>[\w\.]+))(:{0,1})(?P<port>(\d+))?',
self.ssh)
if not match:
return False
data = match.groupdict()
cmd.append(data['port'] or '22')
cmd.append(data['host'])
with open(os.path.expanduser('~/.ssh/known_hosts'), 'a+') as hosts:
subprocess.Popen(cmd, stdout=hosts)

def get_project(self, repo_slug, branch):
self.branch = branch
Expand Down

0 comments on commit 9bf4f57

Please sign in to comment.