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

Commitdc775c2

Browse files
author
vshepard
committed
Add StrictHostKeyChecking=no for ssh connect
1 parent80ba614 commitdc775c2

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

‎testgres/operations/remote_ops.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,13 @@ def __init__(self, conn_params: ConnectionParams):
4848
self.host=conn_params.host
4949
self.ssh_key=conn_params.ssh_key
5050
self.port=conn_params.port
51+
self.ssh_cmd= ["-o StrictHostKeyChecking=no"]
5152
ifself.ssh_key:
52-
self.ssh_cmd= ["-i",self.ssh_key]
53-
else:
54-
self.ssh_cmd= []
53+
self.ssh_cmd+= ["-i",self.ssh_key]
5554
ifself.port:
56-
self.ssh_cmd= ["-p",self.port]
55+
self.ssh_cmd+= ["-p",self.port]
5756
self.remote=True
5857
self.username=conn_params.usernameorself.get_user()
59-
self.add_known_host(self.host)
6058
self.tunnel_process=None
6159

6260
def__enter__(self):
@@ -80,16 +78,6 @@ def close_ssh_tunnel(self):
8078
else:
8179
print("No active tunnel to close.")
8280

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp