mirror of https://github.com/Aidaho12/haproxy-wi
				
				
				
			
							parent
							
								
									9fdaeb0acf
								
							
						
					
					
						commit
						cf2bbce46f
					
				|  | @ -5,6 +5,7 @@ from paramiko import SSHClient | ||||||
| class SshConnection: | class SshConnection: | ||||||
|     def __init__(self, server_ip, ssh_port, ssh_user_name, ssh_user_password, ssh_enable, ssh_key_name=None): |     def __init__(self, server_ip, ssh_port, ssh_user_name, ssh_user_password, ssh_enable, ssh_key_name=None): | ||||||
|         self.ssh = SSHClient() |         self.ssh = SSHClient() | ||||||
|  |         self.ssh.load_system_host_keys() | ||||||
|         self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) |         self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | ||||||
|         self.server_ip = server_ip |         self.server_ip = server_ip | ||||||
|         self.ssh_port = ssh_port |         self.ssh_port = ssh_port | ||||||
|  | @ -16,7 +17,7 @@ class SshConnection: | ||||||
|     def __enter__(self): |     def __enter__(self): | ||||||
|         try: |         try: | ||||||
|             if self.ssh_enable == 1: |             if self.ssh_enable == 1: | ||||||
|                 k = paramiko.pkey.Pkey.from_private_key_file(self.ssh_key_name) |                 k = paramiko.pkey.load_private_key_file(self.ssh_key_name) | ||||||
|                 self.ssh.connect( |                 self.ssh.connect( | ||||||
|                     hostname=self.server_ip, |                     hostname=self.server_ip, | ||||||
|                     port=self.ssh_port, |                     port=self.ssh_port, | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| configparser>=3.5.0 | configparser>=3.5.0 | ||||||
| paramiko>=2.4.3 | paramiko-ng>=2.5.0 | ||||||
| pytz>=2017.3 | pytz>=2017.3 | ||||||
| requests>=2.22.0 | requests>=2.22.0 | ||||||
| pyTelegramBotAPI>=3.6.3  | pyTelegramBotAPI>=3.6.3  | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Pavel Loginov
						Pavel Loginov