Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9c251a4

Browse files
author
vshepard
committed
Add StrictHostKeyChecking=no for ssh connect
1 parentfb8f342 commit9c251a4

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

‎setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
readme=f.read()
2828

2929
setup(
30-
version='1.10.0',
30+
version='1.10.4',
3131
name='testgres',
3232
packages=['testgres','testgres.operations','testgres.helpers'],
3333
description='Testing utility for PostgreSQL and its extensions',

‎testgres/operations/remote_ops.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,13 @@ def __init__(self, conn_params: ConnectionParams):
4646
self.host=conn_params.host
4747
self.ssh_key=conn_params.ssh_key
4848
self.port=conn_params.port
49+
self.ssh_cmd= ["-o StrictHostKeyChecking=no"]
4950
ifself.ssh_key:
50-
self.ssh_cmd= ["-i",self.ssh_key]
51-
else:
52-
self.ssh_cmd= []
51+
self.ssh_cmd+= ["-i",self.ssh_key]
5352
ifself.port:
54-
self.ssh_cmd= ["-p",self.port]
53+
self.ssh_cmd+= ["-p",self.port]
5554
self.remote=True
5655
self.username=conn_params.usernameorself.get_user()
57-
self.add_known_host(self.host)
5856
self.tunnel_process=None
5957

6058
def__enter__(self):
@@ -78,16 +76,6 @@ def close_ssh_tunnel(self):
7876
else:
7977
print("No active tunnel to close.")
8078

81-
defadd_known_host(self,host):
82-
known_hosts_path=os.path.expanduser("~/.ssh/known_hosts")
83-
cmd='ssh-keyscan -H %s >> %s'% (host,known_hosts_path)
84-
85-
try:
86-
subprocess.check_call(cmd,shell=True)
87-
logging.info("Successfully added %s to known_hosts."%host)
88-
exceptsubprocess.CalledProcessErrorase:
89-
raiseException("Failed to add %s to known_hosts. Error: %s"% (host,str(e)))
90-
9179
defexec_command(self,cmd,wait_exit=False,verbose=False,expect_error=False,
9280
encoding=None,shell=True,text=False,input=None,stdin=None,stdout=None,
9381
stderr=None,get_process=None,timeout=None):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp