Skip to content

Commit 1e20cdb

Browse files
author
vshepard
committed
Add StrictHostKeyChecking=no for ssh connect
1 parent 9c251a4 commit 1e20cdb

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

testgres/operations/remote_ops.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
raise ImportError("You must have psycopg2 or pg8000 modules installed")
1515

1616
from ..exceptions import ExecUtilException
17+
from ..utils import reserve_port
1718
from .os_ops import OsOperations, ConnectionParams, get_default_encoding
1819

1920
error_markers = [b'error', b'Permission denied', b'fatal', b'No such file or directory']
@@ -383,7 +384,7 @@ def db_connect(self, dbname, user, password=None, host="localhost", port=5432):
383384
"""
384385
Established SSH tunnel and Connects to a PostgreSQL
385386
"""
386-
self.establish_ssh_tunnel(local_port=port, remote_port=5432)
387+
self.establish_ssh_tunnel(local_port=reserve_port(), remote_port=5432)
387388
try:
388389
conn = pglib.connect(
389390
host=host,

testgres/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ def execute_utility(args, logfile=None, verbose=False):
7474

7575
# write new log entry if possible
7676
if logfile:
77+
if not tconf.os_ops.path_exists(logfile):
78+
tconf.os_ops.touch(logfile)
7779
try:
7880
tconf.os_ops.write(filename=logfile, data=args, truncate=True)
7981
if out:

0 commit comments

Comments
 (0)